I came up with an algorithm for the challenge No Repeats please.
It can’t pass any tests while I always can get correct answer by manually running it. I am wondering if it is because it is so slow that I can’t pass the tests.
Below is my code. Anyone can help me please. Thanks!
It’s probably because you have a global variable
Yes. You are right.
count to a local variable and it works. Thanks!
But do you know why the global variable doesn’t work?
See the first comment here: https://github.com/FreeCodeCamp/FreeCodeCamp/issues/9199
The reason being that we run multiple test cases in on the code, using a global var like this persists the last value and hence the test cases fail.