public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
        ListNode res = null, temp = null;
        int carry = 0;
        while(l1 != null || l2 != null){
            int n1 = 0, n2 = 0;
            if(l1 != null){
                n1 = l1.val;
                l1 = l1.next;
            }
            if(l2 != null){
                n2 = l2.val;
                l2 = l2.next;
            }
            int add = n1 + n2 + carry;
            ListNode item = new ListNode(add % 10);
            carry = add / 10;
            if(temp == null){
                res = item;
                temp = item;
            } else {
                temp.next = item;
                temp = item;
            }
        }
        if(carry > 0){
            ListNode item = new ListNode(1);
            temp.next = item;
        }
        if(res == null){
            res = new ListNode(0);
        }
        return res;
    }