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
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.