public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
        if (l1 == null) {
            return l2;
        } else if (l2 == null) {
            return l1;
        }

        int plus = 0;
        ListNode head = new ListNode(-1);
        ListNode curr = head;
        while (l1 != null && l2 != null) {
            int val = l1.val + l2.val + plus;
            if (val >= 10) {
                val -= 10;
                plus = 1;
            } else {
                plus = 0;
            }
            curr.next = new ListNode(val);
            curr = curr.next;

            l1 = l1.next;
            l2 = l2.next;
        }

        ListNode left = l1 == null ? l2 : l1;
        while (left != null) {
            int val = left.val + plus;
            if (val >= 10) {
                val -= 10;
                plus = 1;
            } else {
                plus = 0;
            }
            curr.next = new ListNode(val);
            curr = curr.next;

            left = left.next;
        }

        if (plus == 1) {
            curr.next = new ListNode(1);
        }
        return head.next;
    }