PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Coinbase

Implement a Simple Banking Ledger

Last updated: Mar 29, 2026

Quick Overview

This question evaluates competence in designing an efficient, stateful ledger API and associated data structures, emphasizing correctness under invalid inputs, performance at scale, integer overflow handling, unit testing for edge cases, and transactional (atomic batch) behavior.

  • Medium
  • Coinbase
  • Coding & Algorithms
  • Software Engineer

Implement a Simple Banking Ledger

Company: Coinbase

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

Design and implement a banking ledger for n accounts labeled 1..n with initial balances. Provide an API: deposit(id, amount) -> bool, withdraw(id, amount) -> bool, transfer(fromId, toId, amount) -> bool. Rules: return false for invalid account IDs or insufficient funds; otherwise apply updates and return true. Constraints: up to 200,000 operations, amounts up to 10^12, target O( 1) per operation and O(n) space; assume single-threaded execution. Sub-questions: write unit tests for edge cases (invalid IDs, zero/negative amounts, overflow), extend to support atomic batches of operations with rollback on partial failure, and analyze time/space complexity and common pitfalls (e.g., integer overflow).

Quick Answer: This question evaluates competence in designing an efficient, stateful ledger API and associated data structures, emphasizing correctness under invalid inputs, performance at scale, integer overflow handling, unit testing for edge cases, and transactional (atomic batch) behavior.

Related Interview Questions

  • Implement an In-Memory Database - Coinbase (hard)
  • Implement a Coin-Constrained Jump Strategy - Coinbase (hard)
  • Implement Game Physics and Block Mining - Coinbase (hard)
  • Compute Total Manual Distance - Coinbase (medium)
  • Implement a Flappy Bird Jump Agent - Coinbase
Coinbase logo
Coinbase
Sep 6, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
6
0

Design and implement a banking ledger for n accounts labeled 1..n with initial balances. Provide an API: deposit(id, amount) -> bool, withdraw(id, amount) -> bool, transfer(fromId, toId, amount) -> bool. Rules: return false for invalid account IDs or insufficient funds; otherwise apply updates and return true. Constraints: up to 200,000 operations, amounts up to 10^12, target O(

  1. per operation and O(n) space; assume single-threaded execution. Sub-questions: write unit tests for edge cases (invalid IDs, zero/negative amounts, overflow), extend to support atomic batches of operations with rollback on partial failure, and analyze time/space complexity and common pitfalls (e.g., integer overflow).

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Coinbase•More Software Engineer•Coinbase Software Engineer•Coinbase 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
  • 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.