struct ListNode* middleNode(struct ListNode* head){ struct ListNode *p=head,*q=head; while(p) { if(p->next==NULL) { break; } if(p->next->next==NULL) { q=q->next; break; } p=p->next->next; q=q->next; } return q; }
原文:https://www.cnblogs.com/ganxiang/p/13693087.html