A garage holds at most capacity cars. events is a list of strings: "in" when a car
arrives and "out" when one leaves. A car arriving at a full garage is turned away (it
does not enter). An "out" when the garage is empty is ignored. Return
[turned_away, cars_inside_at_end].
Examples
Input: capacity = 2, events = ["in", "in", "in", "out", "in", "out", "out", "out"]
Output: [1, 0]
Input: capacity = 0, events = ["in"]
Output: [1, 0]
Constraints
0 <= capacity <= 1000,0 <= len(events) <= 2000
Goals
- Maintain a count bounded by a capacity
- Handle invalid events (full garage, empty garage) gracefully