mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-01-30 22:23:42 +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
|
||||
fast: Node | None = head
|
||||
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
|
||||
fast = fast.next.next
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user