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.
Hi @rsschool_94d9c29d4afff48c ;
As this kata has the
puzzle
tag, it normally means that the description is allowed to be a bit less detailed (because, in this case, any more information will basically spoil the answer), but the test cases are correct.Maybe the wording is not 100% clear: it is asking not for the total amount of grain but rather, which square will you "reach" for a given amount of grains.
For input
3 grains
: you can place 1 grain on square 1, since first square has "capacity" of 1 grain. Then you can place 2 grains on second square since it has capacity of 2 grains.You now have
3-1-2 = 0
grains remaining so you are finished - and you have successfully placed all 3 grains and you only needed 2 squares to do this.For 4 grains, the second square is full so you need to move to the next available square (square #3) which has spare capacity. So answer for
4 grains
is3 squares
.