Ad
  • Custom User Avatar

    This is subtraction with some extra rules. As far as mathmatics, that's pretty much the most straightforward approach. You could possibly use division, but that would be more complicated. The toughest part of this problem is variable management. You need to build some sort of program that accurately keeps track of ingredients, and their quantity. Once you have a good way to keep track of these items, the math is easy.

    Imagine you have a special cake made for you every 5 years. The question in this kata is very similar to "how many times have you had this special cake if you are 23"? With just one variable, the math is easy. The trouble is tracking the eggs, and milk, and flour, and sugar.