Reported September 2026
OpenAIheap priority queue

GPU Credit Ledger

Reported by candidates from OpenAI's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live OpenAI OA. Under 2s to a working solution.
Founder's read

The OpenAI OA reported in September 2026 is called GPU Credit Ledger, and the trap is that operations arrive out of timestamp order. A naive replay of every operation per query gets ugly fast once grants, subtractions, and balance checks pile up. It's a simulation problem with a greedy core: always burn the credits that expire soonest. If you've got the invite and you're short on time, learn the event-ordering rule first. If you blank mid-assessment, StealthCoder runs invisibly as a safety net and gives you a working structure in real time.

The problem

Implement a time-aware GPU credit ledger. Grants add credits for a bounded time interval, spending events consume active credits, and balance queries ask how many credits remain at a timestamp.
Supported operations
ADD grantId amount start expire: register a grant of amount credits. The grant is active for timestamps start <= t < expire.
SUBTRACT amount timestamp: consume amount credits active at timestamp. Consume credits from the grants that expire earliest. The consumption continues to affect later balances until those grants expire. Grants that begin after the subtraction timestamp cannot pay for it. If the active balance is insufficient, do not consume any credits.
BALANCE timestamp: append the remaining active balance at timestamp to the output.
Operations are registered in input order, but their timestamps do not have to be sorted. For events at the same timestamp, expiring grants are no longer active, new grants are active, and then subtraction events are applied in input order.

Function
processGpuCredits(operations: String[]) → String[]

Examples
Example 1
operations = ["ADD a 4 20 60", "ADD b 3 30 40", "SUBTRACT 2 30", "BALANCE 30", "BALANCE 40"]
return = ["5", "4"]
At timestamp 30, both grants are active. The subtraction consumes two credits from grant b because it expires first, leaving a balance of five. At timestamp 40, grant b has expired and grant a still has all four credits.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is to stop thinking in input order and think in timestamp order. Subtractions take credits from the earliest-expiring active grants, and that consumption persists until those grants expire. So a subtraction is really a permanent reduction of specific grants, not a one-time balance dip. Sort events by timestamp, with the tie rule from the statement: expirations first, then new grants, then subtractions in input order. Keep active grants in a min-heap keyed by expiry, each with remaining credits. For a subtraction, check the total active balance first. If it's short, do nothing. Otherwise pop and drain grants from the earliest expiry. The common pitfall is deducting before checking sufficiency, which leaves partial consumption behind. Another is treating the expire time as inclusive. It's exclusive. If the live OA freezes you on the ordering logic, StealthCoder is the hedge that keeps you moving.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill GPU Credit Ledger cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass OpenAI's OA.

OpenAI reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

GPU Credit Ledger FAQ

What's the core trick in GPU Credit Ledger?+

Process events in timestamp order, not input order, and always drain the earliest-expiring active grant first. A min-heap by expiry handles that. The subtraction must reduce the grant's remaining credits so later balances reflect it until the grant expires.

How do I handle events at the same timestamp?+

Follow the statement exactly. Grants expiring at that time are already gone, grants starting at that time are active, then subtractions run in input order. Encode it as a sort key: timestamp, then a type priority, then original index.

What happens if a subtraction exceeds the balance?+

Nothing is consumed. Compute the total active balance first and only drain grants if it covers the amount. Partial consumption is the most common bug here, so check sufficiency before touching any grant.

Is expire time inclusive or exclusive?+

Exclusive. A grant is active when start <= t < expire. In Example 1, grant b expires at 40, so a balance query at 40 doesn't count it, which is why the answer is 4.

How do I prepare for this in 48 hours?+

Practice event-sorting simulations and heap-based greedy draining. Write the sort key and the heap logic from scratch once, then trace Example 1 by hand. Focus on edge cases: equal timestamps, insufficient balance, and out-of-order input.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with OpenAI.

OA at OpenAI?
Invisible during screen share
Get it