Ad
  • Custom User Avatar

    Okay.. so if I used that logic: how do i answer [25, 25, 50, 100] = true ?

    To explain in detail, these were the two encounters I tried to go with:

    1. The change that the clerk can provide INCLUDES the ticket that is sold to the person
      e.g. Clerk has 50, customer gives 100: Clerk has enough change because (remainder of 50 + ticket of 25) = 75
    2. The change that the clerk can provide DOES NOT INCLUDE the ticket to be sold to the person
      e.g. Clerk has 50, customer gives 100: Clerk does not have enough of change because customer needs 75 and clerk CURRENTLY only has 50
  • Custom User Avatar

    "Should return false for {25, 25, 100}"

    I don't quite get this, because the clerk would've had 50 by the time it reached the 3rd person in line. If the clerk sold a ticket to that person, the clerk would've had enough of change at 75 which is needed by the customer.

    I used this logic because it applied to other test cases, or the other cases would've failed.

  • Custom User Avatar

    Test given: [25, 25, 25, 25, 50, 100, 50], to return True; However this is not the case because after accumulating the first four customer's money, the toal adds up to 100, leaving a 25 change for the next customer who pays 50, the total becomes 75; leaving a 75 change for the next customer who pays 100, the total becomes 0; the clerk does not have enough change for the next customer who pays 50.