//url:https://leetcode.com/problems/middle-of-the-linked-list/description/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* middleNode(ListNode* head) {
vector list;
ListNode* tmp=head;
while(tmp->next){
list.push_back(tmp);
tmp=tmp->next;
}
list.push_back(tmp);
return list[list.size()/2];
}
};