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.
There are only 3 random tests (1 for each group) and they only expect a very tiny range of possible values, so it's a lottery that we have actual chances to win at. See this
ou yeah
still took me some time to understand the correct order of events :)
Is there a performance constraint or can we brute force it?
The difficulty of this kata and required strategies depend on it.
Could you provide the bounds for each of the arguments in the description?
This comment is hidden because it contains spoiler information about the solution
I was also mislead by the description of the last example, where it says "the possible result contains negative number". It would be less confusing if it said "the possible result contains a number that is not positive".
I just fixed that specific error and now the author's solution passes again.
But I didn't dig deep enough into the anti-cheating code to be confident that I fixed everything.
You should not be throwing an
Error
, you should be returningundefined
.fixed
When running on initial code base.
Bro, your tree is not symmetric :(
Having a size limit doesn't necessarily imply accepting out of range indexes and % them back in the memory array. It could (and for best practices should) return an error at least on values over 2047 or below -2048
I was mean here for 2048 memory size index 0 is equal to index 2048 and index 1 is equal to index 2049 and so on, on whole extent.
Be very careful with that assumption, as it's only true if the interpreter language accepts negative indexes and interprets them as starting from the end. In javascript for example it would refer to a whole new variable in memory.
Here with 2048 memory cells it is actually true as follows:
memory[-1] === memory[2047]
Loading more items...