尝试迭代实现
struct ListNode* swapPairs(struct ListNode* head) {
if(head == NULL)
return NULL;
if(head->next == NULL)
return head;
struct ListNode *tmp = head->next;
struct ListNode *node = swapPairs(head->next->next);
head->next->next = head;
head->next = node;
return tmp;
}