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.
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)
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.
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.
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.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 :DOh wait, and I failed to notice that
product
method exists, so myreduce(_ * _)
was entirely unnecessary. Learning new things every day :)You can't submit in a Draft.
Done
.
Oooops
Ok - I'll fix it, may be I've mistyped extra zero ;)
Thank you for the attention
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
100K
70K
overkill much?
Loading more items...