Ad
  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    I think you misunderstood the rules:

    when a customer buys three items of certain products, they get the cheapest item for free.

    Please note: cheapest item for free.
    The most expensive is not free, the supermarket is not charity ;-)

  • Default User Avatar

    I feel like I am missing something. The kata states calculate discount so it works out best for customer (meaning biggest discount). This would imply that in a buy 2 get 1 free store and buying 15 items, the top 5 priciest items would be free. Yet, that doesnt appear to be what is expected.

    After a quick investigation, I dont know what this Kata is validating. Example:
    3 items in basket (13.95, 49.77, 35.82)

    I expect to discount the highest priced item (49.77) and the total would be 13.95 + 35.82 - which is 49.77. But this Kata is expected 85.59 - which is 49.77 + 35.82. This is the oppisite of the desired behavior.