Add Linked Lists
Given a singly linked list l0
and another linked list l1
, each representing a number with least significant digits first, return the summed linked list.
Note: Each value in the linked list is guaranteed to be between 0 and 9.
Constraints
n ≤ 100,000
wheren
is the number of nodes inl0
m ≤ 100,000
wherem
is the number of nodes inl1
https://binarysearch.com/problems/Add-Linked-Lists
Examples
Example 1
Input
- l0 =
- l1 =
Output
- answer =
Explanation
This is 46 + 74 = 120
Leave a comment