• Custom User Avatar

    Ultimately it's just finding all connected components, so I know there are existing katas about it. Though I couldn't find the approve one last time either (when I did the kata linked above)

  • Custom User Avatar

    I think there's also an approved kata about minimal amount of swaps. I found one for bubble sort, I am trying to find one with longer swaps too.

  • Custom User Avatar
  • Custom User Avatar

    The kata implicitly assumes that there are no duplicates in the input array. (Fixed tests have no duplicates, and random tests have such a wide element value range duplicates are exceedingly unlikely)

    The task becomes significantly harder if duplicates exist, so this must be specified in the description.

  • Custom User Avatar

    There is only 1 random test with length = 400000. It's either win or bust; failed test will time out or run out of memory trying to print the error message, which makes the kata un-debuggable.

  • Custom User Avatar

    Random tests generate negative values in the array, which is already unexpected; on top of that, the reference solution expects all negative dollar values to use singular form, which is grammatically wrong.

  • Custom User Avatar

    Range sum queries is already done in several existing katas (such as https://www.codewars.com/kata/583d10c03f02f41462000137).

  • Custom User Avatar

    Related to below: length 1 snakes aren't tested.

  • Custom User Avatar

    The lower range of snake length isn't specified (or at least only implied to be between 1 and 2), which is kind of a big deal: Besides length 2 snakes, length1 snakes is also a special edge case.

  • Custom User Avatar

    Hehe, mine was entirely the same (save for whitespaces and 2nd parameter name).

    But then I rewrote the conversion to digits to s"$n".map(_-'0'), so in the end I differ :D

    Oh wait, and I failed to notice that product method exists, so my reduce(_ * _) was entirely unnecessary. Learning new things every day :)

  • Custom User Avatar

    You can't submit in a Draft.

  • Custom User Avatar

    Done

  • Custom User Avatar

    .

  • Custom User Avatar

    Oooops
    Ok - I'll fix it, may be I've mistyped extra zero ;)

    Thank you for the attention

  • Custom User Avatar

    Kata description says Write optimal solution, cause worm can be long (10k), and there can be a lot of instructions (7k).

    But in practice (Java) I am seeing some tests pass

    • worm len = 100K
    • instructions len = 70K

    overkill much?

  • Loading more items...