less than 1 minute read

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 where n is the number of nodes in l0
  • m ≤ 100,000 where m is the number of nodes in l1

https://binarysearch.com/problems/Add-Linked-Lists

Examples

Example 1

Input

  • l0 =
  • l1 =

Output

  • answer =

Explanation

This is 46 + 74 = 120

Solution

Leave a comment