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;
}

京公网安备 11010502036488号