@@ -0,0 +1,1243 @@
+import java.util.Deque;%0Aimport java.util.LinkedList;%0A%0Apublic class _0002AddTwoNumbers %7B%0A  public ListNode addTwoNumbers(ListNode l1, ListNode l2) %7B%0A    if (l1 == null) %7B%0A      return l2;%0A    %7D%0A    if (l2 == null) %7B%0A      return l1;%0A    %7D%0A    Deque%3CListNode%3E s1 = new LinkedList%3C%3E();%0A    Deque%3CListNode%3E s2 = new LinkedList%3C%3E();%0A    while (l1 != null) %7B%0A      s1.addLast(l1);%0A      l1 = l1.next;%0A    %7D%0A    while (l2 != null) %7B%0A      s2.addLast(l2);%0A      l2 = l2.next;%0A    %7D%0A    ListNode head = null;%0A    ListNode next = null;%0A    int c = 0;%0A    while (!s1.isEmpty() %7C%7C !s2.isEmpty()) %7B%0A      int val1 = s1.isEmpty() ? 0 : s1.pop().val;%0A      int val2 = s2.isEmpty() ? 0 : s2.pop().val;%0A      int val = val1 + val2 + c;%0A      ListNode node = new ListNode(val %25 10);%0A      if (head == null) %7B%0A        head = node;%0A      %7D%0A      if (next != null) %7B%0A        next.next = node;%0A      %7D%0A      next = node;%0A      c = val / 10;%0A    %7D%0A    if (c != 0) %7B%0A      ListNode node = new ListNode(c);%0A      next.next = node;%0A    %7D%0A    return head;%0A  %7D%0A%0A  public class ListNode %7B%0A      int val;%0A      ListNode next;%0A      ListNode() %7B%7D%0A      ListNode(int val) %7B this.val = val; %7D%0A      ListNode(int val, ListNode next) %7B this.val = val; this.next = next; %7D%0A  %7D%0A%7D%0A

Add _0002AddTwoNumbers