Ad
  • Default User Avatar

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

  • Default User Avatar

    agreed. could be done in a single loop which would be a better practice

  • Default User Avatar

    is console.log meant to not be working?

  • Default User Avatar

    No random tests specifically in javascript. this can be taken advantage of

  • Default User Avatar

    have you checked that you return the code rather than print to console?

  • Default User Avatar

    i dont know this language but be wary on future discussions that the issue tag is for issues in the kata not issues in your personal code. that would not need a tag at all.

  • Default User Avatar

    basically think of it like this O(1) would be going the same speed no matter how many items inputted into the function, O(n) is the time it takes to complete the function is linear with how many items is inputted. so if we went through the items twice, it would be O(2n). and as shown above we have one loop inside another. meaning we go through that second loop multiple times and the outside one once. you would find this to be O(n^2) so say its 1 second per item for O(n), in the O(n^2) 6 items would take 36 seconds, 8 would take 64 seconds, etc, etc. kinda lengthy but i hope it helped

  • Default User Avatar

    basically think of it like this O(1) would be going the same speed no matter how many items inputted into the function, O(n) is the time it takes to complete the function is linear with how many items is inputted. so if we went through the items twice, it would be O(2n). and as shown above we have one loop inside another. meaning we go through that second loop multiple times and the outside one once. you would find this to be O(n^2) so say its 1 second per item for O(n), in the O(n^2) 6 items would take 36 seconds, 8 would take 64 seconds, etc, etc. kinda lengthy but i hope it helped

  • Default User Avatar

    This kata seems to be lacking any example test solutions so the only way to test if it works is by pressing the attempt button

  • Default User Avatar

    Thank you for the contribution

  • Default User Avatar

    Thank you i have added a test case and made it more clear, including an example.

  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

    Took me a long while to get this one as an 8 kyu, much harder than it first appears but satisfying to solve.