We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d2b3c1d commit fb13521Copy full SHA for fb13521
data_structures/linked_list/merge_sort_linked_list.py
@@ -47,6 +47,8 @@ def get_middle(head: Node | None) -> Node | None:
47
slow: Node | None = head
48
fast: Node | None = head
49
while fast is not None and fast.next is not None:
50
+ if slow is None: # This should never happen, but it satisfies the type checker
51
+ return None
52
slow = slow.next
53
fast = fast.next.next
54
0 commit comments