Given the head of a singly linked list, swap every two adjacent nodes and return the head of the modified list. You must solve it by only changing node links (not the values stored inside the nodes).
Input / output
head: ListNode (JSON test fixture is a plain array of node values, e.g. [1, 2, 3, 4] means 1 -> 2 -> 3 -> 4 -> null)ListNode (serialized the same way)0 <= node value <= 100Can you solve it both iteratively (with a dummy head and a prev pointer) and recursively, and explain why the recursive version costs O(n) call-stack space that the iterative version avoids?