Skip to main content
hard

GPU Credits Manager

GPU Credits Manager You're building a GPU credit ledger. Events can arrive out of order. RULES: 1) Grants are valid in [grant_timestamp, expiration_timestamp) 2) subtract() allocates from soonest-expiring grants first (FEFO) - tie-breaker: lexicographically smaller grant_id 3) Overdraw: partial take, no error, no negative balance 4) Timestamps are NOT monotonic 5) Same timestamp: a grant at time T is available for a subtract at time T 6) Duplicate grant_id: ignore the second create_grant (first wins)

Build a GPU credit ledger where events arrive out-of-order. Grants expire, subtracts allocate FEFO (soonest-expiring-first), and queries ask for balance at any timestamp. Part 2 adds retroactive cancellations, forcing full replay correctness.

Meet Coco

Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Sign in free to type with Coco, up to a daily limit, and to talk with her for one hour. After that, talking comes with the $79 pack. Anyone can open the editor and run their code.

1Replay + FEFOhard
2Part 2

Each locked part opens in the editor once the part before it passes.

Get a note when something new lands

New company guides, new problems and big changes to Coco. Rare, and you can leave any time. By joining you agree to get these emails.