LeetCode 筆記 - 876. Middle of the Linked List
題目在此 876. Middle of the Linked List
![image 11](https://codingman.cc/images/auto/642502d4905f0332e7eb6ac6f0ed67cd.jpg)
給一個 Linked list,請回傳中間的 node
解題思維
這題使用了 Two Pointers (超好用一定要學會
因為是需要找到中間的 node,所以 head 每移動兩步 result 移動一步就可以了
結束之後 result 就會停在中間的 node
完成 🥰
程式碼
1 | # Definition for singly-linked list. |