Home
Log in
DescriptionSubmissionsSolution
DescriptionSubmissionsSolution
Loading...

Log in to run or submit

l1 =
l2 =

Codey

Practise coding problems, test your solutions and track your progress.

Explore

  • Problems
  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

© 2026 Codey. Personal learning project.

Solution
Updated: 2026-02-23

Idea

Add digit by digit with carry, like elementary addition.

Approach

Traverse both lists simultaneously. Sum current digits and carry, create a new node for sum % 10, update carry.

Why it works

The lists represent numbers in reverse order, so least significant digits come first, matching left-to-right traversal.

Code
Loading...
Complexity
Time: O(n+m)
Space: O(n+m)
Solution
Updated: 2026-02-23

Idea

Add digit by digit with carry, like elementary addition.

Approach

Traverse both lists simultaneously. Sum current digits and carry, create a new node for sum % 10, update carry.

Why it works

The lists represent numbers in reverse order, so least significant digits come first, matching left-to-right traversal.

Code
Loading...
Complexity
Time: O(n+m)
Space: O(n+m)