Siddarth and Permutation in Graph Theory

Can anyone help me with the concept? Not able to access the editorial of the problem as well.

Hey @tisandas2011
This question is based on graph and topological sorting. Consider values in array A as indexes which are part of a chain. Eg if A[2] = 3, then element at index 3 is next value after value at index 2 and so on. You’ll get multiple chains this way. Keep on assigning values to the chains incrementally this way.

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.