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.
head = [1,2,3,4,5][3,4,5]head = [1,2,3,4,5,6][4,5,6]slow = head and fast = head at index 0fast != null && fast.next != null: loop continuesslow = slow.next (1 step) and fast = fast.next.next (2 steps)fast at null or last node. slow is now at the middle. Return slow.Since fast moves exactly twice as fast as slow, when fast has covered the entire list (reaches null or the last node), slow has covered exactly half the distance — landing on the middle. For even-length lists, fast lands on the last node after covering n−1 steps, so slow ends at index ⌊n/2⌋ (the second middle), matching LeetCode's requirement.