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.
This is not a recursive solution. Array.from uses a loop.
This comment is hidden because it contains spoiler information about the solution
If you figure out whether to add/divide based on powers of -1, aren't you wasting a lot of compute power when i gets large? Wouldn't it be more efficient to simply store this in a flag?
This comment is hidden because it contains spoiler information about the solution
Is this really easy enough for 8 kyu? It seems the difficulty level is too high. Perhaps if it was changed into a function, instead of adding a new method to an existing class.
Is this really simple enough to be level 8 kyu? It seems much more difficult than other 8 kyu problems.
The looped section should be enclosed in {}. I don't understand why this code passed the test in the first place :/
Yeah, but if the author were to add an if statement which started calculating only if the top of the range was very high, they could keep the advantage of speed whilst making their solution general purpose.
This is a good solution, but it only works with an array of length = 4.
You should change the "exponent = 3" variable to "exponent = arr.length - 1" to allow this function to work on a binary array of any length.