Ad
  • Custom User Avatar

    can you help ?

    smart 🤣🤣

  • Custom User Avatar

    Do the maths once again :-)

  • Custom User Avatar

    Nice kata though I would prefer if it came with boolean return value and a better title.

  • Custom User Avatar

    No, because you're not thinking on bills, you have 100 dollars, yes, but 2 50 dollars bills, how do you give 75 back like that?

  • Default User Avatar

    This precondiotion is completely wrong:
    Line.Tickets(new int[] { 25, 25, 50, 50, 100 }) // => NO. Vasya will not have the right bills to give 75 dollars of change (you can't make two bills of 25 from one of 50)
    Explanation:

    1. 0 available at the start of the 1 step -> sell 1 ticket without change -> available sum = 25
    2. 25 available at the start of the 2 step -> sell 2 ticket without change -> available sum = 50
    3. 50 available at the start of the 3 step -> sell 3 ticket with 25 change -> available sum = 75 (50 -25+ 50)
    4. 75 available at the start of the 4 step -> sell 4 ticket with 25 change -> available sum = 100 (75 - 25 + 50)
      Obviously if You have 100 dollars, you can sell the last ticket
  • Default User Avatar

    ohhhhhh ok, that makes sense. thanks.

  • Custom User Avatar

    Your logic is incorrect. Just because you receive a 100 dollar bill, doesn't mean you can give 25 change for next customer. Likewise, if you have one 50 dollar bill, and next customer gives a 50, there's no way for you to give change.

  • Default User Avatar

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

  • Default User Avatar

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