Created
March 4, 2019 00:26
-
-
Save kafagy/890605ea9d8e9d6c3a68a55f8ca82e94 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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