mirror of
https://github.com/TheAlgorithms/C
synced 2025-04-22 13:16:14 +03:00
10 lines
228 B
C
10 lines
228 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;
|
|
}
|