public ListNode middleNode(ListNode head) { ListNode fast=head,slow=head;//新建双节点一快一慢 while(fast!=null&&fast.next!=null){ slow=slow.next; fast=fast.next.next;//当fast比slow双倍移动时 } return slow; }