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.
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.
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.
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.
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/...
(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
Also, this kata is a duplicate of https://www.codewars.com/kata/63fd2f144b2e93003e26fcd1
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.
This comment is hidden because it contains spoiler information about the solution
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.
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.
Range sum queries is already done in several existing katas (such as https://www.codewars.com/kata/583d10c03f02f41462000137).
Related to below: length
1
snakes aren't tested.The lower range of snake length isn't specified (or at least only implied to be between
1
and2
), which is kind of a big deal: Besides length2
snakes, length1
snakes is also a special edge case.ok, so, question part:
Suggestions part (both strong suggestions, like: without them, you'll make a lot of users angry at you):
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.
in java, it's now an array, not a list, so this looks suboptimal. Suggestion:
list/array
Sorry, but this is duplicate of already approved katas, here are some:
https://www.codewars.com/kata/586e6b54c66d18ff6c0015cd
https://www.codewars.com/kata/587387d169b6fddc16000002
package com.example
.