2019-09-26 08:29:31 -07:00

10 lines
230 B
C

struct ListNode* swapPairs(struct ListNode* head) {
if(!head || !head->next)
return head;
struct ListNode *tmp = head->next;
head->next = swapPairs(head->next->next);
tmp -> next = head;
return tmp;
}