Skip to content

Commit 6086339

Browse files
author
Chris Cooper
committed
Initialize dummy and node on the same line. Remove an extra line.
1 parent 3e74db9 commit 6086339

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

python/0023-merge-k-sorted-lists.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ def mergeKLists(self, lists: List[ListNode]) -> ListNode:
1818
return lists[0]
1919

2020
def mergeList(self, l1, l2):
21-
dummy = ListNode()
22-
node = dummy
21+
dummy = node = ListNode()
2322

2423
while l1 and l2:
2524
if l1.val < l2.val:
@@ -31,5 +30,4 @@ def mergeList(self, l1, l2):
3130
node = node.next
3231

3332
node.next = l1 or l2
34-
3533
return dummy.next

0 commit comments

Comments
 (0)