Algorithm · LinkedIn · Easy
You are handed head, the first node of a singly linked list that contains at least one node, along with an integer n. Take the node sitting at position n and relocate it so that it becomes the first node of the list, then return the head of the rearranged list. Every other node must keep the same order relative to one another. The rearrangement must be done by rewiring the next pointers between nodes; simply exchanging the values stored in nodes is not acceptable. Positions…