Ad
  • Custom User Avatar

    Yeah! I was wondering if this could be done without having to destructure the pair... learning so much from everyone here :)

  • 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