Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
In the end I managed to find the solution, a great kata!!
This comment is hidden because it contains spoiler information about the solution
That's not a kata
issue
, usequestion
.for
is a loop, andindexOf
is a loop-alike method, they're nested so your algorithm isO(n ^ 2)
, it won't work.If you get that error, change your language version to
3.6.0
I can't select other version, but to some people,
3.4.3
is shown too.It is not.
Quesion answered by Chrono79 alredy. Closing.
Thanks Chrono79
Yes, avoid them.
I should avoid nested loops all together? This problem is more difficult than a kyu 5 problem. By the way, thanks for the reply.
It's a problem with your code:
Your code should be O(n)
Mark your post as having spoiler content next time.
Both functions are O(n ^ 2) filter and includes are loop-alike functions and they're nested in the first one, the second one have two nested for loops. Neither won't work. Your code should be faster O(n).
This comment is hidden because it contains spoiler information about the solution
Hi, I get 61 tests passed without any errors, but I get
Exit Code: 1
with my javascript solution.Please, can someone tell me if the problem is that we have to optimize the function even more, or if it's a problem of the exercise.