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.
I see that you solved it, closing an issue.
this solution is invalid.
@goodwin64: He calculates sum from 1 to n-1 so he get wrong result, but difference is slight if n or k is enough big.
xrange(1,5) = [1,2,3,4]
solution = a => (a[0] = -1) + 2;
This code pass final test cases for js.
If a is [1, -1] you get infinite loop.
Your code check only first element of p.
And you misunderstood this kata. Look at the question below.
Previous issue about the this problem. At first you need find maximum power of 2 for given number then maximum power of 3 for rest of the number then maximum power of 4 for next rest of the number and so on.