876. Middle of the Linked List 發表於 2023-02-13 | 分類於 leetcode problemsolution123456789101112class Solution {public: ListNode* middleNode(ListNode* head) { ListNode *slow = head, *fast = head; while(fast && fast->next ){ fast = fast->next->next; slow= slow->next; } return slow; }}; analysis time complexity O(n) speed complexity O(1)