# https://leetcode.com/problems/lemonade-change from typing import List class Solution: def lemonadeChange(self, bills: List[int]) -> bool: inventory: List[int] = [0, 0] for bill in bills: match bill: case 5: inventory[0] += 1 case 10: inventory[0] -= 1 inventory[1] += 1 if inventory[0] < 0: return False case 20: if inventory[1] == 0: inventory[0] -= 3 else: inventory[1] -= 1 inventory[0] -= 1 if inventory[0] < 0 or inventory[1] < 0: return False return True