0% found this document useful (0 votes)
21 views1 page

Add Two Numbers - LeetCode

Uploaded by

Rehan Mahmood
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views1 page

Add Two Numbers - LeetCode

Uploaded by

Rehan Mahmood
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Problem List Run Submit Register or Sign in Premium

Description Editorial Solutions Submissions Code

 Python Auto
2. Add Two Numbers 1 # Definition for singly-linked list.
2 # class ListNode(object):
Medium Topics Companies 3 # def __init__(self, val=0, next=None):
4 # self.val = val
You are given two non-empty linked lists representing two non-negative integers. The 5 # self.next = next
digits are stored in reverse order, and each of their nodes contains a single digit. Add 6 class Solution(object):
the two numbers and return the sum as a linked list. 7 def addTwoNumbers(self, l1, l2):
8 """
You may assume the two numbers do not contain any leading zero, except the number 0 9 :type l1: Optional[ListNode]
10 :type l2: Optional[ListNode]
itself.
11 :rtype: Optional[ListNode]
12 """
13

Example 1:

Saved

You need to Login / Sign up to run or submit


32.2K 727 331 Online Testcase Test Result

You might also like