The while loop for l2 in the above case should take care of the failing test case.

Am i missing something very basic here?

```
public class Solution {
public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
int carry = 0;
ListNode result = null;
while (l1 != null && l2 != null) {
int total = (l1.val + l2.val + carry) % 10;
carry = (l1.val + l2.val + carry) / 10;
ListNode r = new ListNode(total);
if (result == null) {
result = r;
} else {
result.next = r;
}
l1 = l1.next;
l2 = l2.next;
}
while (l1 != null) {
int total = (l1.val + carry) % 10;
carry = (l1.val + carry) / 10;
ListNode r = new ListNode(total);
if (result == null) {
result = r;
} else {
result.next = r;
}
l1 = l1.next;
}
while (l2 != null) {
int total = (l2.val + carry) % 10;
carry = (l2.val + carry) / 10;
ListNode r = new ListNode(total);
if (result == null) {
result = r;
} else {
result.next = r;
}
l2 = l2.next;
}
if (carry == 1) {
ListNode r = new ListNode(1);
carry = 0;
result.next = r;
}
return result;
}
}
```

Following is the failing case:

input : {1},{9,9}

output : {0,1}

expected output: {0,0,1}