Ad
  • Custom User Avatar

    That n is part of another expression, and ,1 is setting initial value.

  • Custom User Avatar

    All those tests are ok, in the first one you can't give change to the last customer with a 50 dollars bill, the second, the last 100 dollars bill and so on.

    Can Vasya sell a ticket to every person and give change if he initially has no money and sells the tickets strictly in the order people queue?

    Return YES, if Vasya can sell a ticket to every person and give change with the bills he has at hand at that moment. Otherwise return NO

    Read that again, it seems you're grabbing all the money and then giving the change when you should give change to every customer in the order they come.