May long challenge TRPLSRT problem

please help me solve the given problem.

Hi,

You can approach this problem in ways:

  1. Make cycles in the array. If the array is 3 1 2 4 then 3 is connected to 2(where 3 should be present) 2 is connected to 1(where 2 should be present ) and 1 is connected to 3.
  2. there are two cases:
    if the size of cycle is odd then answer always exist.
    if the size of cycle is even then u have to think in which case answer exist or not.

Now, try to solve the problem.