876. Middle of the Linked List
问题
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.
快慢指针,两个指针不同速度遍历链表。当快指针达到链表尾部时候,慢指针正好在中间。
1 | /** |
876. Middle of the Linked List
https://xuanhe95.github.io/2022/04/07/876-Middle-of-the-Linked-List/