OpenAIVerified interview challenge
GPU Credits
Implement a credit ledger with expiring grants and transactions recorded out of order.
Unlock with Full AccessThe challenge
Build a service that tracks GPU credits and returns the available balance at a given time. Credit grants expire, and grants or spending can be recorded out of order.
GPU Credits has been asked in OpenAI software engineering interviews.
What you'll practise
Credit expiration
Handle balance queries before and after grants expire.
Out-of-order transactions
Account for events recorded in a different order from when they happened.
Data structures
Choose how to store grants and usage so you can calculate balances.
solution.pyPython 3.13
class GPUCredit:
def __init__(self) -> None:
pass
# Your implementation goes hereTest cases
Run your code to see results.
Full instructions, starter code and test cases included with Full Access.