class Solution { public: ListNode* middleNode(ListNode* head) { if (head == NULL) { return nullptr; } vector<ListNode*> List; List.push_back(head); int count = 1; while (head->next != NULL) { ListNode* n = head->next; List.push_back(n); head = head->next; count++; } return List[count / 2]; } };
leetcode876
猜你喜欢
转载自www.cnblogs.com/asenyang/p/9714820.html
今日推荐
周排行