prev
and curr
, to traverse list1
.\n2. Move curr
to the ath
node and prev
to the node just before it.\n3. Continue moving curr
until it reaches the node just after the bth
node.\n4. Connect prev.next
to the head of list2
.\n5. Traverse to the end of list2
and connect its last node's next
to curr
.\n6. Return the head of the modified list1
.