Help with a problem - PERMUT2

can anyone tell me what is wrong with my code
The problem statement is
and my code is
I have run some examples of the internet and some other examples of the discussion forum and all of those have been correct. Please try some of your examples and tell me what is the problem.

I can’t see anything wrong with the logic (and it passes plenty of randomised testing), but:

a) The constraints say N \le100000, but you are only allocating space for 1000
b) There is no limit stated for the number of testcases, but again you are only allocating space for 1000

you are right it was about the contraints

1 Like