Hi all,

I couldn’t understand the logic mentioned in the book which solves in O(n) time and O(1) space complexity. Can anyone point me to some youtube link or some other resource where there are more examples explained? I really want to understand the logic behind this question.

Thanks in advance.

Edit : I now understood the basic idea behind this problem’s solution. Can anyone explain me the test-case result?

Shouldn’t it be what I got in the result? What I understand is, after applying permutation, A[0] should be what it was in A[7] before applying permutation. Am I right?