Ad
  • Custom User Avatar

    I saw it. My point was that the tests passed the right arrays, and expected results were correct, so the issue wasn't with the kata itself. I agree that every var should be replaced with const / let but that's a minor issue (especially considering that the kata is in beta for 7 or so years).

  • Custom User Avatar

    no, i figured everything out. i realised exactly what the issue was. see my solution to see how i fixed that

  • Custom User Avatar

    I'm not an oracle, so I don't know. Global variables? Confusion?

    You can always go to Solutions tab and fork any solution, and play around with it. You can modify tests as you see fit (you will notice that adding const doesn't change anything). Tests pass a copy of the array, so the expected result isn't affected by your code.

  • Custom User Avatar

    See above. I marked it as spoiler just in case. The "issue" seems to come from your code.

  • Custom User Avatar

    what would then?

  • Custom User Avatar

    Yeah, that wouldn't really fix the problem... const in JS doesn't mean what you think it does.

  • Custom User Avatar

    that's why you always make randomized tests

  • Custom User Avatar

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

  • Custom User Avatar

    Poor description! nth pick stands for number of rounds and it also stands for the position of the element you have to return after completing the rounds!

  • Custom User Avatar

    This taught me quite a bit about writing tests. Very clever.

  • Custom User Avatar

    Thanks for letting me know. I just fixed that, and made the random tests be more random. Your solution should fail most of the tests now.

  • Custom User Avatar

    Your random tests are vulnerable to input modification.

  • Custom User Avatar

    I see. I changed nth to nthPick and added a few examples. Does that clear up any confusion?

  • Custom User Avatar

    The thing is that it's not very clear what nth means:

    list: abcde
    
    nth = 5 -> e
    abcdeedcbaabcde...
        ^
    nth = 9 -> b
    abcdeedcbaabcde...
            ^
    

    nth actually means something like above rather than things like "nth round".

  • Custom User Avatar

    Don't snake drafts act the same for larger sets as they do for smaller sets? E.g., abc...xyz, then zyx...cba, then abc...xyz and so on?

    Are the test cases not doing that?

  • Loading more items...