Where am i going wrong?

https://www.codechef.com/viewsolution/57383273

Your output for the test input:

1
8 2

is:

1 2 3 4 5 6 8 7 

which has 7 subarrays that are permutations, not 2.

1 Like