I had heard this question from my friend who attended an interview recently:
Given the head of the linked list, Write a function to swap the head with the next element in the linked list and return the pointer to the new head.
Ex:
i/p: 1->2,3,4,5 (the given head is 1)
o/p: 2->1,3,4,5
Assuming
then the solution might look something like