mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
Fix
This commit is contained in:
parent
1ac1f0c0e4
commit
ed62d33870
|
@ -35,10 +35,12 @@ def get_middle(head: Node | None) -> Node | None:
|
|||
if head is None or head.next is None:
|
||||
return None
|
||||
|
||||
slow: Node = head
|
||||
slow: Node | None = head
|
||||
fast: Node | None = head.next
|
||||
|
||||
while fast is not None and fast.next is not None:
|
||||
if slow is None:
|
||||
return None
|
||||
slow = slow.next
|
||||
fast = fast.next.next
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user