Ad
  • Custom User Avatar

    "missing test cases" when you click test and then the solution passes when you click submit
    JS version of this should not exist
    really hated this.

  • Custom User Avatar

    Thank you! Superb explanation. Now it makes sense

  • Custom User Avatar

    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 is 3 squares.

  • Custom User Avatar

    One of test cases states that the input 3 must produce result of 2. This implies that the total amount of grain is summed up, i.e. the character in this puzzle receives grain/rice from all squares up to and including the last one. But other test cases clearly imply that he or she gets the amount only from the last square. This is a very sloppy kata and test cases and description have to be more clear. Or am I missing something?

  • Custom User Avatar