Ad
  • Custom User Avatar

    'First transaction thru transaction four: add $25 to the register (total is $100).
    Fifth transaction: make change for $25 ($75 in register).'
    You're making change for the customers, but you're forgetting to take their initial bill. In essence, you're giving all of your money away. Your total value should increase by $25 because that's what each customer is paying.

  • Custom User Avatar

    The test case is correct, it's about the exact number of each bill you have, not the total.
    After customer 5, you have five 25s. Once you get that 100, you need to give back $75 (three 25s).
    You're left with one 100 and two 25s. When you get that second 100, you can't give him back $75 with two 25s and one 100.
    Also on step 6, you're subtracting 75, but only adding 25.. If you have 125 and he gives you 100, you're left with 225. THEN you give him 75, and finally you'll have 150, not 75