mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
Fix
This commit is contained in:
parent
4aa953e400
commit
62d2412482
|
@ -44,10 +44,10 @@ def get_middle(head: Node | None) -> Node | None:
|
|||
if head is None or head.next is None:
|
||||
return head
|
||||
|
||||
slow = head # one node at a time
|
||||
slow: Node | None = head # one node at a time
|
||||
fast = head # two nodes at a time
|
||||
while fast.next and fast.next.next:
|
||||
slow: Node | None = slow.next
|
||||
slow = slow.next
|
||||
fast = fast.next.next
|
||||
return slow
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user