Skip to content

Instantly share code, notes, and snippets.

@kafagy
Created March 4, 2019 00:26
Show Gist options
  • Save kafagy/890605ea9d8e9d6c3a68a55f8ca82e94 to your computer and use it in GitHub Desktop.
Save kafagy/890605ea9d8e9d6c3a68a55f8ca82e94 to your computer and use it in GitHub Desktop.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def addTwoNumbers(self, l1, l2):
temp = []
carry = 0
while(not l1.val is None or not l2.val is None):
if not l1.next is None:
l1 = l1.next
else:
l1.val = None
if not l2.next is None:
l2 = l2.next
else:
l2.val = None
if carry == 1:
temp.append(carry)
return temp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment