Sale
Summer Offer: $190/yr $99/yr
00 : 00 : 00 : 00
Get this deal
Coding Round 1 Mid-Level programming

LeetCode #2 - Add Two Numbers

Given two non-empty linked lists representing two non-negative integers, where each node contains a single digit. The digits are stored in reverse order, meaning that the 1's digit is at the head of the linked list. You need to add the two numbers and return it as a linked list.
Function Signature: def addTwoNumbers(l1: ListNode, l2: ListNode) -> ListNode:
Example 1:
Input: l1 = [2,4,3], l2 = [5,6,4]
Output: [7,0,8]
Explanation: 342 + 465 = 807.
Example 2:
Input: l1 = [0], l2 = [0]
Output: [0]
Constraints: 1 <= len(l1), len(l2) <= 100, 0 <= Node.val <= 9.
Suggested Answer

Trusted by 100+ professionals preparing for interviews

Trusted by 100+ professionals 50+ Company Question Banks 5+ Supported Languages

Practice More Questions Like This

Generate unlimited interview questions with structured answers, code runner, and AI-powered walkthroughs.

Get Started Free

More Coding Round 1 Interview Prep

System Design: Design a URL Shortener
System Design · Mid-Level
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Link copied to clipboard