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.
The C++ randomized tests are ridiculously more difficult than the Javascript ones. Here are a few randomized tests from the Javascript cases:
and the madness that are the randomized C++ cases:
I ended up implementing an optimization just for these
1, 2, big_number, ..., big_number
cases, which funnily enough is enough to pass them (assuming that the rest of your code is somewhat efficient). Otherwise a recursive solution simply isn't performant enough.Fixed.
That was a typo, fixed
That won't work with inputs starting or containing zeroes (
[0, 1, 2]
will simply return 0)Yes, there was a merge conflict because of that. Forked and fixed the conflict here:
https://www.codewars.com/kumite/5cd3387ffb6f25456f8806b4?sel=5cd887ca5bf451002485da8e
Have you modified the description between now and then?
https://www.codewars.com/kumite/5cd86e4ecedf620011e59dfa?sel=5cd86e4ecedf620011e59dfa
^ Javascript translation :)
JS has
Math.PI
, but it only goes up to the 64bit float precision, so no guarantee past the 12th-13th digit I'd sayJavascript here, you should provide some sample test cases. I'm flagging this as an issue, as it is essential for a Kata to provide them
Mathematically, the sum of nothing is zero (it's called an empty sum). The product of nothing is 1 (this one is called an empty product, sometimes marked with
_
)This comment is hidden because it contains spoiler information about the solution
Wait a minute...
CodeWars should mention that somewhere (it doesn't yet). All my apologies, it is indeed about the C implementation
There is an
indexOf
method on arrays too :)Nevermind, read it wrong
Loading more items...