Add Two Numbers Problem
Add Two Numbers Problem — ExecCode Easy DSA Practice
Solve the Add Two Numbers problem on ExecCode. Free online easy DSA practice in Linked List. Write and run code in Java, C++, Python — no signup required to run.
Problem description
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order. Add the two numbers and return the sum as a linked list.
Examples
Input l1 = [2, 4, 3], l2 = [5, 6, 4]; Output [7, 0, 8]. Input l1 = [0], l2 = [0]; Output [0]. Input l1 = [9, 9, 9, 9, 9, 9, 9], l2 = [9, 9, 9, 9]; Output [8, 9, 9, 9, 0, 0, 0, 1]
Constraints
Each list has 1–100 nodes 0 ≤ Node.val ≤ 9
Practice Add Two Numbers free on ExecCode. Browse DSA problems, topic map, and placement guides.