You are viewing a single comment's thread. Return to all comments →
I'm confused... The sample states that we get chocolates per trip, and that means we get wrappers per trip. However, this also means that we get an extra chocolates per trip, right?
Given 10 dollars with chocolates for 2 dollars each, you can get 5 chocolates. That's 5 wrappers. To get a free chocolate, you need 5 wrappers, which we have, so now we have 6 chocolates. This means we now have 1 extra wrapper (total: 6, extra: 1)
Next, we have 12 dollars with chocolates for 4 dollars each. That means we can purchase 3 chocolates, meaning we now have 3 wrappers, plus the extra 1 from the last purchase. We need 4 wrappers to get a free chocolate, which we have, so we get a free chocolate and consequently have 1 extra wrapper (total: 4, extra: 1)
Finally, we have 6 dollars to spend on chocolates for 2 dollars each. This means we can buy 3 chocolates, giving us 3 new wrappers, plus the extra 1 from the last purchase. We need 2 wrappers to obtain a free chocolate, and we actually have 4 wrappers, meaning we get 2 free chocolates and 2 more wrappers as a consequence. We can obtain 1 chocolate more for free as a result, leading to 1 final chocolate and 1 extra wrapper (total: 6, extra: 1)
So how is the sample output 6, 3, 5 when we can clearly obtain 6, 4, 6?
What am I missing?
I am having the same issue, not sure when the extra wrappers count and when they don't.
The way it works is the number of leftover wrappers doesn't carry over to the next trip to the store, meaning once you can no longer trade for a free chocolate, any extra wrappers you have are no longer able to be traded.