This commit is contained in:
Hardik Pawar 2024-10-03 11:39:31 +05:30
parent 5556acb7f8
commit 4aa953e400

View File

@ -47,7 +47,7 @@ def get_middle(head: Node | None) -> Node | None:
slow = head # one node at a time slow = head # one node at a time
fast = head # two nodes at a time fast = head # two nodes at a time
while fast.next and fast.next.next: while fast.next and fast.next.next:
slow = slow.next slow: Node | None = slow.next
fast = fast.next.next fast = fast.next.next
return slow return slow