Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
13 lines (12 loc) · 438 Bytes

File metadata and controls

13 lines (12 loc) · 438 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
class Solution:
def addTwoNumbers(self, l1, l2 ,c = 0):
val = l1.val + l2.val + c
c = val // 10
ret = ListNode(val % 10 )
if (l1.next != None or l2.next != None or c != 0):
if l1.next == None:
l1.next = ListNode(0)
if l2.next == None:
l2.next = ListNode(0)
ret.next = self.addTwoNumbers(l1.next,l2.next,c)
return ret
Morty Proxy This is a proxified and sanitized view of the page, visit original site.