DEV Community

Discussion on: Daily Challenge #144 - Box Office Clerk

Collapse
 
rafaacioly profile image
Rafael Acioly • Edited

Python solution 🐍

from typing import List

TICKET_VALUE = 25

def tickets(values: List[int]) -> str:
  register = 0

  for amount in values:
    change = amount - TICKET_VALUE
    if register < change:
      return "NO"
    register += TICKET_VALUE

  return "YES"