题解 | #链表的奇偶重排#
链表的奇偶重排
https://www.nowcoder.com/practice/02bf49ea45cd486daa031614f9bd6fc3
function oddEvenList( head ) { if ( !head || !head.next ) { return head; } let odd = head; let even = head.next; let evenHead = even; while ( even && even.next ) { odd.next = even.next; odd = odd.next; even.next = odd.next; even = even.next; } odd.next = evenHead; return head; }