
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Check which edges need to be changed.
Let the next node of the (a-1)th node of list1 be the 0-th node in list 2.
Let the next node of the last node of list2 be the (b+1)-th node in list 1.