Adding Digit Lists
Medium · Adding Digit Lists
Two non-negative integers are stored in the singly linked lists `first` and `second`. Each node holds one digit, and the digits go from the least significant to the most significant. For instance, 503 is stored as 3 → 0 → 5. Return their sum as a list in the same format, least significant digit first. Both lists are non-empty. The numbers have no leading zeros, except for the number 0 itself, which is a single node.…
Solve the problem →