You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each node contains a single digit. Add the two numbers and return the sum as a linked list.
l1 = [2,4,3], l2 = [5,6,4][7,0,8]l1 = [9,9,9,9,9,9,9], l2 = [9,9,9,9][8,9,9,9,0,0,0,1]l1 = [0], l2 = [0][0]dummy node, curr = dummy, carry = 0l1 != null || l2 != null || carry != 0d1 = l1.val (or 0), d2 = l2.val (or 0)sum = d1 + d2 + carry; new carry = sum / 10sum % 10 to result; advance pointersdummy.nextStoring digits in reverse order means the least-significant digit comes first. This lets us add digit-by-digit from left to right — exactly how long addition works — without needing to reverse anything. A carry from one column flows naturally to the next node. If the final carry is 1 (e.g. 999 + 1), we append one more node without any special handling.