Friday, April 10, 2015

HackerRank::Algorithms::Warmup::Chocolate Feast

  We need to implement the process of buying the chocolates. Initially he buys N/C chocolates. Even if some money is left we don't need to consider it anymore, because we can't by more with money, we need to buy with wrappers. Then we need to buy as many chocolates as we can with the current number of wrappers, then eat the chocolates and see if we have enough wrappers to buy at least one more chocolate, if we do, then do this step again, until we can't buy any more.


        

No comments:

Post a Comment