β back to unit
Medium
# stacks medium
Dish Duty
Dishes arrive in bursts while you wash from the top of the pile. Dinner rush chaos! π§½
You get events β arrive:3 (that many dishes join the pile) or wash (top dish washed; washes always valid). Print one line: washed <total washed> left <pile size>.
Example:
Input: events = ["arrive:3", "wash", "wash", "arrive:2", "wash"]
Output: washed 3 left 2
The pile grows to 3, two washes shrink it to 1 and score 2, arrive:2 grows it to 3, and one more wash shrinks it to 2 and scores a 3rd wash β 3 washed total, 2 left.
π‘ need a hint?
stk-dish-duty.pyπ given lines are locked β write your code in between
loading...