Think of this in that way:
For smaller n like 1000 you do 1000 * 1000 iterations (10 ^ 6) and it shouldnt make any problems,
But if n is 1 000 000 then you are doing 1 000 000 * 1 000 000 iterations (10 ^ 12).
Now compare amount of iterations done for n = 1000 and n = 1 000 000 (btw there are random tests for n as big as 1 000 000).
If you couldn't find the right way to do this kata you can look at the comments of others who give you direct approach you can use.
Loading collection data...
Think of this in that way:
For smaller n like 1000 you do 1000 * 1000 iterations (10 ^ 6) and it shouldnt make any problems,
But if n is 1 000 000 then you are doing 1 000 000 * 1 000 000 iterations (10 ^ 12).
Now compare amount of iterations done for n = 1000 and n = 1 000 000 (btw there are random tests for n as big as 1 000 000).
If you couldn't find the right way to do this kata you can look at the comments of others who give you direct approach you can use.