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]; } };