What should we do in this q

what is the approach of this problem

Hi @hhiteshbansal_40d12e2460a1738e
you can visualize the problem in reverse order like how the array will look when it would be sorted, now think how which element it get swapped with
eg say array is 1 3 2
then sorted array is : 1 2 3 we can see 3,2 got swapped so ans is 1
eg say array is 1 4 2 3
sorted array : 1 2 3 4, swapping 2,3 --> 1 3 2 4, again swapping 3,4 we get the original array1 4 2 3 so ans is 2

@hhiteshbansal_40d12e2460a1738e hope the doubt is clear now i’m marking it as resolved then.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.