Given the head of a singly linked list, return the middle node of the linked list.
If there are two middle nodes, return the second middle node.
This problem elegantly demonstrates the fast & slow pointer technique. When the fast pointer reaches the end, the slow pointer will be at exactly the middle. Think of it like two runners on a track - when the faster one finishes, the slower one is at the halfway point.
head = [1,2,3,4,5][3,4,5]head = [1,2,3,4,5,6][4,5,6]The number of nodes in the list is in the range [1, 100]1 <= Node.val <= 100Click "Run" to execute your code against test cases
Socratic guidance - I'll ask questions, not give answers