Help me in solving PERMUTATION_ problem

My issue

Please,anyone provide me logic and intution of approch to solve this problem

Problem Link: https://www.codechef.com/problems/PERMUTATION_

You can approach two pointers here to solve this problem