Node *pairWiseSwap(Node *head)
{
if (head == NULL || head->next == NULL)
return head;
Node *prev = head;
Node *curr = head->next;
head = curr;
while (true)
{
Node *next = curr->next;
curr->next = prev;
if (next == NULL || next->next == NULL)
{
prev->next = next;
break;
}
prev->next = next->next;
prev = next;
curr = prev->next;
}
return head;
}