Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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
.