Compare commits
No commits in common. "50e3c941ca9cce60d5d37e16a3bc9e7652a0c7c1" and "c5c82a3ba1eb37819e4251164d6a89b013b0fee6" have entirely different histories.
50e3c941ca
...
c5c82a3ba1
@ -1,21 +0,0 @@
|
|||||||
def mergeTwoLists(l1, l2):
|
|
||||||
"""
|
|
||||||
:type list1: Optional[ListNode]
|
|
||||||
:type list2: Optional[ListNode]
|
|
||||||
:rtype: Optional[ListNode]
|
|
||||||
"""
|
|
||||||
dummy = ListNode()
|
|
||||||
tail = dummy
|
|
||||||
while l1 and l2:
|
|
||||||
if l1.val < l2.val:
|
|
||||||
tail.next = l1
|
|
||||||
l1 = l1.next
|
|
||||||
else:
|
|
||||||
tail.next = l2
|
|
||||||
l2 = l2.next
|
|
||||||
tail = tail.next
|
|
||||||
if l1:
|
|
||||||
tail.next = l1
|
|
||||||
elif l2:
|
|
||||||
tail.next = l2
|
|
||||||
return dummy.next
|
|
||||||
Loading…
Reference in New Issue
Block a user