Given the head of a linked list, swap every two adjacent nodes and return its head.
You must swap the nodes themselves (pointers), not just the values.
If the list has an odd number of nodes, the last node is left in place.
Input: Head of a singly linked list.
Output: Head of the list after pairwise swapping.
Input: [1,2,3,4]
Output: [2,1,4,3]
Explanation: Pair (1,2)→(2,1), pair (3,4)→(4,3). Result: 2→1→4→3.Input: [1,2,3,4,5]
Output: [2,1,4,3,5]
Explanation: Pairs swapped: (1,2)→(2,1), (3,4)→(4,3). Node 5 unchanged.Input: [1]
Output: [1]
Explanation: Single node. No pair to swap. Return as is.0<=nodes<=1000<=Node.val<=100