We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 62d2412 commit d2b3c1dCopy full SHA for d2b3c1d
data_structures/linked_list/merge_sort_linked_list.py
@@ -44,11 +44,12 @@ def get_middle(head: Node | None) -> Node | None:
44
if head is None or head.next is None:
45
return head
46
47
- slow: Node | None = head # one node at a time
48
- fast = head # two nodes at a time
49
- while fast.next and fast.next.next:
+ slow: Node | None = head
+ fast: Node | None = head
+ while fast is not None and fast.next is not None:
50
slow = slow.next
51
fast = fast.next.next
52
+
53
return slow
54
55
0 commit comments