PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCareers
|Home/Coding & Algorithms/OpenAI

Implement GPU credit ledger

Last updated: Apr 23, 2026

Quick Overview

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.

  • Medium
  • OpenAI
  • Coding & Algorithms
  • Software Engineer

Implement GPU credit ledger

Company: OpenAI

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

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: ( 1) init(events): initialize internal state by applying the given ordered events; ( 2) getBalance(tenantId): return the current credit balance for the specified tenant; ( 3) applyEvent(event): process a new single event and update state. Define the event schema (tenantId, delta, optional timestamp/id), decide whether to reject events that would drive balances below zero or allow negatives, and handle idempotency if event ids repeat. Aim for O( 1) average time per operation after O(n) initialization, and discuss data structures, concurrency considerations, and how you would persist state for crash recovery.

Quick Answer: 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.

Related Interview Questions

  • Simulate Infection Spread on a Grid - OpenAI (hard)
  • Implement Social Follow Recommendations - OpenAI (medium)
  • Build a Compose Rating Card - OpenAI (medium)
  • Convert IPv4 Ranges to CIDR Blocks - OpenAI (medium)
  • Implement Persistent KV Store Serialization - OpenAI (hard)
OpenAI logo
OpenAI
Sep 6, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
31
0
Coding Console

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: (

  1. init(events): initialize internal state by applying the given ordered events; (
  2. getBalance(tenantId): return the current credit balance for the specified tenant; (
  3. applyEvent(event): process a new single event and update state. Define the event schema (tenantId, delta, optional timestamp/id), decide whether to reject events that would drive balances below zero or allow negatives, and handle idempotency if event ids repeat. Aim for O(
  4. average time per operation after O(n) initialization, and discuss data structures, concurrency considerations, and how you would persist state for crash recovery.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More OpenAI•More Software Engineer•OpenAI Software Engineer•OpenAI Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • Careers
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.