← Coinbase Interview Insights

Coinbase·Software Engineer·Technical Phone Screen·Senior

Senior
Jul 2026

Summary

Coinbase software engineering interview that was basically one long design problem broken into four escalating parts. The scope kept expanding and by the end I was sketching out merge logic for user histories which I did not see coming at all.

Questions Asked (4)

Q1

Design an in-memory banking system with account creation, deposits, and transfers between users. How do you handle error cases like unknown users or insufficient funds?

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

Pretty standard starting point but I fumbled the error handling spec a bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and defining the core data model (accounts, balances, transactions). Then outline the API and walk through the happy path for account creation, deposits, and transfers. Finally, systematically address error cases (unknown users, insufficient funds) and discuss trade-offs like atomicity, consistency, and concurrency.

Pro tip: Emphasize idempotency and atomicity for transfers—use a transaction-like approach to ensure either both debit and credit succeed or neither does. Also, mention how you'd handle concurrency (e.g., locking or optimistic concurrency) to prevent race conditions.

1. Clarify Requirements and Scope

Ask questions to understand expected scale, consistency needs, and whether this is single-threaded or concurrent. Confirm that in-memory means no persistence and that we need basic error handling.

2. Design Data Model and API

Define a simple Account class with userId and balance, and a Bank class managing accounts. Specify methods: createAccount(userId), deposit(userId, amount), transfer(fromUserId, toUserId, amount).

3. Implement Core Operations

Walk through the logic for each operation: createAccount checks for duplicates; deposit validates user and positive amount; transfer validates both users, checks sufficient funds, and atomically updates balances.

4. Handle Error Cases

For each operation, define specific exceptions or error returns: UnknownUserException, InsufficientFundsException, InvalidAmountException. Ensure transfers are atomic—if any step fails, no changes are made.

5. Discuss Trade-offs and Extensions

Talk about concurrency control (e.g., synchronized methods, locks, or optimistic locking), idempotency for deposits/transfers, and potential extensions like transaction history or multi-currency support.

Key Points to Mention

  • Atomicity of transfers: use a transaction-like approach to ensure both debit and credit happen or neither.
  • Concurrency control: synchronized methods, locks, or optimistic concurrency to prevent race conditions.
  • Idempotency: ensure repeated requests (e.g., due to retries) don't double-charge or double-credit.
  • Error handling: define clear exceptions and return meaningful error messages for unknown users, insufficient funds, and invalid amounts.
  • Data consistency: maintain invariants like total money in system remains constant (except deposits/withdrawals).
  • Scalability considerations: in-memory limits, potential need for sharding or persistence in real-world scenarios.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Add a method to return the top K accounts ranked by total outgoing spend. What data structure do you use and how do you define tie-breaking?

Algorithms & Data StructuresData Modeling
Author's notes

I went straight to a heap and the interviewer seemed fine with that.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the data model and constraints first, then propose a min-heap of size K for O(n log K) time and O(K) space, or a balanced BST if dynamic updates are needed. Define tie-breaking explicitly (e.g., account ID ascending) and discuss how to handle ties at the K-th boundary.

Pro tip: Mention that tie-breaking should be deterministic and documented, and consider whether ties should be included (returning more than K) or truncated—this shows attention to product requirements and edge cases.

1. Clarify requirements and data model

Ask about the data source (e.g., list of accounts with spend), whether the method is called once or repeatedly, and if K is small relative to N. Confirm the definition of 'outgoing spend' and tie-breaking expectations.

2. Choose the right data structure

For a one-time query, use a min-heap of size K to track the top K accounts. For dynamic updates, consider a balanced BST or a combination of hash map and heap. Explain the trade-offs.

3. Define tie-breaking logic

Specify a deterministic secondary key, such as account ID ascending, to ensure consistent ordering. Discuss whether to include all accounts tied at the K-th spend or truncate arbitrarily.

4. Analyze complexity and edge cases

State time and space complexity (O(N log K) time, O(K) space for heap). Handle edge cases: K=0, K>N, negative spend, and ties at the boundary.

5. Provide code or pseudocode

Outline the algorithm: iterate through accounts, maintain heap, and extract top K. If needed, sort the final K elements by spend descending and account ID ascending.

Key Points to Mention

  • Min-heap of size K for efficient top-K selection
  • Time complexity O(N log K) and space O(K)
  • Tie-breaking by account ID ascending for determinism
  • Handling ties at the K-th boundary (include all or truncate)
  • Alternative data structures (balanced BST, quickselect) and their trade-offs
  • Edge cases: K=0, K>N, negative spend, dynamic updates

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

Extend the system to support scheduled future payments with unique IDs, cancellation, and a mechanism to advance time and execute due payments.

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

This is where it got interesting.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then design a data model for scheduled payments with unique IDs and cancellation. Propose a time-advancement mechanism (e.g., a priority queue or sorted structure) to efficiently execute due payments, and discuss trade-offs between in-memory and persistent storage.

Pro tip: Mention idempotency and exactly-once execution to prevent duplicate payments, and discuss how to handle failures during execution (e.g., retries with exponential backoff).

1. Clarify Requirements

Ask about scale, persistence needs, time granularity, and whether payments can be modified after scheduling. Confirm that unique IDs are system-generated and cancellation is allowed before execution.

2. Design Data Model

Define a ScheduledPayment entity with fields: id (UUID), amount, currency, recipient, executionTime, status (scheduled/cancelled/executed). Use a database table or in-memory store with an index on executionTime for efficient querying.

3. Implement Time Advancement

Introduce a TimeProvider interface to abstract current time. For execution, use a min-heap (priority queue) of payments ordered by executionTime, or a scheduler that polls the database for due payments. Discuss trade-offs: heap is efficient for in-memory but loses state on restart; database polling is durable but may have latency.

4. Handle Cancellation and Execution

For cancellation, mark the payment as cancelled (soft delete) and remove from the heap if present. For execution, atomically update status to executed and process payment, ensuring idempotency via unique ID and status check.

5. Discuss Scalability and Reliability

Address distributed scenarios: use a distributed lock or leader election for a single executor, or shard payments by ID. Consider persistence, crash recovery, and exactly-once semantics.

Key Points to Mention

  • Unique ID generation (UUID) and idempotency to prevent duplicate payments
  • Data structures: min-heap/priority queue for efficient due payment retrieval
  • Time abstraction (TimeProvider) for testability and simulation
  • Cancellation mechanism: soft delete and removal from execution queue
  • Trade-offs between in-memory vs. persistent storage (speed vs. durability)
  • Handling failures: retries, dead-letter queues, and exactly-once execution

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

Implement a mergeUsers operation that combines two accounts, preserves full transaction history, and handles any scheduled payments that involved the source user after the merge.

System DesignData ModelingAPI & Integrations
Author's notes

Did not expect this one.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then design a data model that preserves transaction history and handles scheduled payments. Walk through the merge process step-by-step, covering data migration, idempotency, and rollback strategies. Emphasize consistency, auditability, and edge cases.

Pro tip: Propose a two-phase approach: first, mark the source account as 'merging' to prevent new transactions, then perform the merge asynchronously with idempotent operations. This shows foresight about production safety and scalability.

1. Clarify Requirements and Constraints

Ask about expected data volume, consistency requirements, downtime tolerance, and regulatory constraints. Confirm whether the merge is reversible and how scheduled payments should be handled.

2. Design Data Model and Storage

Propose a schema that links transactions to a user ID and supports reassignment. Consider using a separate mapping table or updating foreign keys, and ensure audit logs capture the merge.

3. Plan the Merge Process

Outline steps: validate both accounts, freeze source account, reassign transactions and scheduled payments, update balances, and mark source as merged. Ensure idempotency and atomicity where possible.

4. Handle Scheduled Payments

Identify all future-dated payments involving the source user, update them to reference the target user, and notify relevant parties. Consider recurring payments and third-party integrations.

5. Address Edge Cases and Rollback

Discuss handling of concurrent operations, failures during merge, and rollback procedures. Include monitoring, logging, and alerting for the merge process.

Key Points to Mention

  • Idempotency of merge operations to avoid duplicate processing
  • Transaction history preservation via immutable ledgers or audit trails
  • Handling of scheduled payments: reassignment, cancellation, or notification
  • Data consistency and isolation levels during merge
  • Rollback and recovery strategies in case of failure
  • Regulatory and compliance considerations (e.g., KYC, AML)

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.