Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the nodes.
Swap Nodes in Pairs

Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the nodes.

Example 1:
Input: [1,2,3,4]
Output: [2,1,4,3]
Input
arr =[1,2,3,4]

Start swapping

1pos 02pos 13pos 24pos 3NULL
Current pair: 1
Pairs swapped: 0
Total nodes: 4
Variables
No variables to display
DepthFunction Call
Stack empty
0/3