Question
Simulate a bounded blocking queue with one producer and one consumer over discrete ticks. The queue has capacity 'cap'. events is a list of strings, one per tick, each 'P' (producer attempts to enqueue one item) or 'C' (consumer attempts to dequeue one item). A 'P' that finds the queue full is BLOCKED (no item added, counts as a blocked-produce). A 'C' that finds the queue empty is BLOCKED (counts as a blocked-consume). Successful operations change the queue size. Return [items_consumed, blocked_produces, blocked_consumes, final_queue_size].
bounded_queue_sim(cap: int, events: list[str]) → list[int][2,["P","P","P","C"]]out[1,1,0,1]State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.