Ad
  • 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

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

  • 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

    ok, so, question part:

    • Did you check that the O(n²) soluiton actually cannot pass? Yo have to be absolutely sure about that => add the solution to your tests, then switch the calls to check that it's effectively timing out

    Suggestions part (both strong suggestions, like: without them, you'll make a lot of users angry at you):

    • the special case for the worm of size 2 isn't explained in the description, it's just "suggested". It should be made clear
    • you still didn't tell "in plain text" that you use math plan (x,y). Again, just say it out loud instead of disguising the info into the definition of up/right/...
  • Custom User Avatar

    (x,y) -> you need to explain that you're considering "regular mathematical plan", hence x horizontal+to the right, y vertical+up. Most users here will consider 2D array indexing more natural, so just state it.

    You explained it somehow giving the directions definitions. Imo it'd be better to stated in the sentence just before those definitions that you're using mathematical cartesian plane.

    The first element of list is the head.

    in java, it's now an array, not a list, so this looks suboptimal. Suggestion: list/array

  • Custom User Avatar

    Sorry, but this is duplicate of already approved katas, here are some:
    https://www.codewars.com/kata/586e6b54c66d18ff6c0015cd
    https://www.codewars.com/kata/587387d169b6fddc16000002

  • Custom User Avatar
    • You should be able to remove package com.example.
    • It could be helpfull to specify what's expected for an empty list.