findMiddleNode
that finds and returns the middle node of the list in a single pass.1 ==> 1
1->2 ==> 1
1->2->3->4 ==> 2
1->2->3->4->5 ==> 3
slow = slow.next
fast = (fast.next).next
ListNode
reference reaches the end of the linked list. ListNode
. Return slow
public ListNode findMiddleNode(ListNode head) { }
C
Java
Python