Standard Bar Linked List · Medium Problems of LL O(max(N, M)) · O(max(N, M))
Two accounting terminals store big balances as digit chains, least significant digit first — the one layout where addition can start immediately at the head. A reconciliation pass walks both chains together, sums paired digits plus the running carry, emits each sum digit, and appends one final digit if a carry outlasts both chains.
Input: Two arrays nums1 and nums2 of digits 0-9, each representing a non-negative integer with the least significant digit first.
Output: The digit sequence of the sum, least significant digit first.
1 <= nums1.length, nums2.length <= 10^50 <= node value <= 9Input: {"nums1":[2,4,3],"nums2":[5,6,4]}
Output: [7,0,8]
342 + 465 = 807, emitted least significant digit first as 7, 0, 8.
Input: {"nums1":[0],"nums2":[0]}
Output: [0]
0 + 0 = 0 — a single zero digit, no carry anywhere.