How to approach this problem.not getting any intution
In order to solve this problem, notice that if all values are distinct then if max_value is equal to length of array then it is a permutation(obviously if element are greater than zero).
So try to find indexes from start as well as end where this condition is satisfied.
can you explain permutation with example …i m bit confused