...

/

Swap Nth Node with Head

Swap Nth Node with Head

Given the head of a singly linked list and 'n', swap the head with the nth node. Return the head of the new linked list.

g head head 7 7 head->7 NULL NULL 28 28 35 35 28->35 14 14 7->14 21 21 14->21 21->28 42 42 35->42 42->NULL
Access this course and 1400+ top-rated courses and projects.
Lifetime Discount - 50% Off
$13
$24.83/month