This question evaluates a candidate's ability to design efficient stateful systems and algorithmic data structures for tracking per-tenant resource balances, including handling idempotency, negative balance policies, concurrency, and persistence.
You manage a GPU pool with per-tenant credits. Given a list/stream of events where each event adjusts a tenant’s credit balance by a signed integer (positive = add credit, negative = deduct credit), implement three functions: (