mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-07 10:00:55 +00:00
Fix
This commit is contained in:
parent
d2b3c1d11a
commit
fb13521086
|
@ -47,6 +47,8 @@ def get_middle(head: Node | None) -> Node | None:
|
||||||
slow: Node | None = head
|
slow: Node | None = head
|
||||||
fast: Node | None = head
|
fast: Node | None = head
|
||||||
while fast is not None and fast.next is not None:
|
while fast is not None and fast.next is not None:
|
||||||
|
if slow is None: # This should never happen, but it satisfies the type checker
|
||||||
|
return None
|
||||||
slow = slow.next
|
slow = slow.next
|
||||||
fast = fast.next.next
|
fast = fast.next.next
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user