mirror of
https://github.com/TheAlgorithms/C
synced 2025-04-22 21:43:08 +03:00
10 lines
230 B
C
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;
|
|
|
|
}
|