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 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 :)