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.
As Chrono said, I think you misread the instructions. If you still don't understand why it isn't 1, I can go into more detail. Just let me know.
How is
1
equal to3 + 4 + 3 + 2 + 1
? There's no mistake in the instructions. Read them again:I found a mistake in the detailing of the problem, it specifies that whenever multiple solutions are present, it should return the lowest index, even in the test example {[1,2,3,4,3,2,1]} it says its expecting a 3 when the lowest index that satifies the solution is 1 ... puzzling
It is indeed somewhat inefficient and potentially return an error, given p0 = 100, percent = 2, aug = 10, p = 100 (I know, evil)
it would return 1 year, while the correct answer would be 0.
To solve it, initialize years = 0, get rid of the initial pCalc (that already assumes it year 1), and place it all inside the loop :)