Ad
  • Default User Avatar

    In the end I managed to find the solution, a great kata!!

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    That's not a kata issue, use question. for is a loop, and indexOf is a loop-alike method, they're nested so your algorithm is O(n ^ 2), it won't work.

  • Custom User Avatar

    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.

  • Custom User Avatar

    This problem is more difficult than a kyu 5 problem

    It is not.

    Quesion answered by Chrono79 alredy. Closing.

  • Default User Avatar

    Thanks Chrono79

  • Custom User Avatar

    Yes, avoid them.

  • Default User Avatar

    I should avoid nested loops all together? This problem is more difficult than a kyu 5 problem. By the way, thanks for the reply.

  • Custom User Avatar

    It's a problem with your code:

    JavaScript Completions 2496

    Your code should be O(n)

  • Custom User Avatar

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

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    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.