參考資訊:
https://www.cnblogs.com/grandyang/p/5138936.html
題目:

解答:
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
struct ListNode* oddEvenList(struct ListNode *head)
{
struct ListNode *tmp = NULL;
struct ListNode *odd = NULL;
struct ListNode *even = NULL;
if ((head == NULL) || (head->next == NULL)) {
return head;
}
tmp = head->next;
odd = head;
even = head->next;
while (odd->next && even->next) {
odd->next = odd->next->next;
odd = odd->next;
even->next = even->next->next;
even = even->next;
}
odd->next = tmp;
return head;
}