# Renewed Solution

The main point is that if there are 2 more nodes (which is a pair) following, then swap them, otherwise, end the process.

```
bool SwapHelper(ListNode *p)
{
if (p->next and p->next->next)
{
ListNode *n1 = p->next;
ListNode *n2 = p->next->next;
p->next = n2;
n1->next = n2->next;
n2->next = n1;
return true;
}
return false;
}
ListNode *swapPairs(ListNode *head)
{
if (!head)
return nullptr;
// Create a head Node
ListNode new_head(-1);
new_head.next = head;
ListNode *p = &new_head;
// While has two more node and swap succeeded
while (SwapHelper(p))
p = p->next->next;
return new_head.next;
}
```