题解 | #链表的奇偶重排#
链表的奇偶重排
https://www.nowcoder.com/practice/02bf49ea45cd486daa031614f9bd6fc3
struct ListNode* oddEvenList(struct ListNode* head ) { // write code here if(!head || !head->next) return head; struct ListNode *head1=head->next,*p=head,*q=head1; while(p->next && q->next){ p->next=q->next; p=p->next; q->next=p->next; q=q->next; } p->next=head1; return head; }