/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int x) { val = x; }
* }
*/
class Solution {
public ListNode middleNode(ListNode head) {
List<ListNode> node = new ArrayList<>();
int num = 0;
for(ListNode p = head;p != null; p = p.next){
node.add(p);
num++;
}
return node.get(num/2);
}
}