Coinbase logo

Coinbase Hard Interview Questions

12 hard-level practice questions for Coinbase technical interviews

Coinbase software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.

Software Engineer Backend Engineer Frontend Engineer Full Stack Engineer Mobile Engineer Data Engineer Data Scientist ML Engineer DevOps Engineer DevOps Engineer Product Manager SRE Security Engineer Engineering Manager Data Analyst UX/UI Designer QA Engineer
coding Hard Verified Question #1

1. Design Iterators


Category: Array coding problem

Question For this problem, you will be designing a series of different iterator classes. This problem is split into multiple related parts that...

Input: Array of integers
Output: Computed result
Want to practise this one?
Create a free account to open the full question and practise Coinbase questions with AI.
Sign up free
coding Hard Verified Question #2

2. Transaction System


Category: Tree coding problem
For this problem, you will be designing a system to handle financial transactions and account balances. This problem is split into three related...
Input: List
Output: Integer
coding Hard Verified Question #3

3. OA[CodeSignal] Cloud File Storage System


Category: Graph coding problem

Question Your task is to implement a simple in-memory cloud storage system that maps objects (files) to their metadata (name, size, etc.). You...

Input: Graph (nodes and edges)
Output: Array
coding Hard Verified Question #4

4. OA[CodeSignal] Design Banking System


Category: Graph coding problem

Question Design a banking system that supports account management, transactions, and various financial operations.

Input: Graph (nodes and edges)
Output: Computed result
coding Hard Verified Question #5

5. Capital Gains Tax Calculator


Category: String coding problem
You are given a chronologically sorted list of stock transactions. Each transaction is a list of strings in the format `[<timestamp>, <type>,...
Input: Array of strings
Output: Computed result
coding Hard Verified Question #6

6. OA [CodeSignal] Knowledge Base System


Category: Graph coding problem
Design and implement a personal knowledge base called KnowledgeBaseSystem that stores articles with CRUD operations. The system operates entirely...
Input: Graph (nodes and edges)
Output: Computed result
coding Hard Verified Question #7

7. Transaction Query Engine


Category: String coding problem
Design a system to filter and paginate a list of transaction records. Each record is a list of strings in the format `[timestamp, id, userId,...
Input: Array of strings
Output: Computed result
coding Hard Verified Question #8

8. Order Matching Engine


Category: String coding problem
You are managing a cryptocurrency order book. The book holds buy and sell orders placed by traders. - A buy order indicates the maximum price a...
Input: String
Output: Computed result
coding Hard Verified Question #9

9. Account Transfer System


Category: String coding problem
You are given a list of fund transfer instructions and a set of accounts with initial balances. Each transfer moves a fixed percentage of the...
Input: List
Output: Computed result
coding Hard Verified Question #10

10. Restaurant Delivery Network


Category: String coding problem
You are building a food discovery platform. Given a user's location, a list of restaurants with their coordinates, and a menu of items with prices,...
Input: List
Output: Computed result
coding Hard hash map #1

1. [Hash Map + Binary Search] — Two-key historical store with hierarchical deletion


Background
Coinbase wallet and account interfaces display balances for multiple assets, while support investigations may need an earlier view of the same account. Model an in-memory store of derived balance snapshots keyed by account and asset; this is a queryable projection, not an authoritative financial ledger.
Problem statement
Implement HistoricalBalanceStore, a two-key, timestamped key-value store. The primary key is an account_id, the secondary key is an asset, and the value is an opaque decimal string such as "50.00".
Each mutation has an integer timestamp. Mutation timestamps are strictly increasing across the entire store, including deletions of nonexistent keys. Reads may request any timestamp, including timestamps earlier than the most recent mutation. A read without a timestamp returns the latest state.
A write makes its value visible starting at its timestamp, replacing the previous value for that account/asset pair. Deleting an asset makes that pair absent starting at the deletion timestamp. Deleting an account makes every asset belonging to that account absent, without destroying earlier history. Later writes may recreate an asset or account, but must not resurrect other previously deleted values.
Historical reads return the state after all mutations whose timestamps are less than or equal to the requested timestamp. Reading a missing pair returns null; reading all assets of a missing account returns {}. Deleting a missing key is permitted and still consumes its timestamp. Reads do not change the store.
An account deletion must not scan its assets. Each mutation should take amortized O(1) time, and a pair lookup should use binary search over the relevant histories rather than scan events. An account-wide read may inspect every distinct asset ever written under that account. Return maps have no required key order.
Function or class signature
  • HistoricalBalanceStore() — construct an empty store.

  • set(account_id: str, asset: str, value: str, timestamp: int) -> None

  • delete_asset(account_id: str, asset: str, timestamp: int) -> None

  • delete_account(account_id: str, timestamp: int) -> None

  • get(account_id: str, asset: str, timestamp: int | None = None) -> str | None

  • get_all(account_id: str, timestamp: int | None = None) -> dict[str, str]


Example 1:
Input, with each operation applied to one initially empty store:
{
  "operations": [
    ["set", "acct-A", "BTC", "0.50", 10],
    ["set", "acct-A", "ETH", "2.00", 20],
    ["set", "acct-A", "BTC", "0.75", 30],
    ["get", "acct-A", "BTC", 25],
    ["delete_asset", "acct-A", "BTC", 40],
    ["get", "acct-A", "BTC"],
    ["get_all", "acct-A", 35],
    ["get_all", "acct-A"]
  ]
}

Output, one result per operation; mutations return null:
[null, null, null, "0.50", null, null, {"BTC": "0.75", "ETH": "2.00"}, {"ETH": "2.00"}]

Explanation: At timestamp 25, BTC still has its timestamp-10 value. The deletion at timestamp 40 hides BTC from the latest view, but not from the timestamp-35 view.
Example 2:
Input:
{
  "operations": [
    ["set", "acct-B", "BTC", "1.00", 5],
    ["set", "acct-B", "ETH", "4.00", 8],
    ["delete_account", "acct-B", 12],
    ["get_all", "acct-B", 12],
    ["set", "acct-B", "BTC", "0.25", 15],
    ["get_all", "acct-B"],
    ["get_all", "acct-B", 11],
    ["delete_account", "acct-B", 18],
    ["get", "acct-B", "BTC", 15],
    ["get_all", "acct-B"]
  ]
}

Output:
[null, null, null, {}, null, {"BTC": "0.25"}, {"BTC": "1.00", "ETH": "4.00"}, null, "0.25", {}]

Explanation: The deletion at 12 hides both assets. Writing BTC at 15 recreates only BTC, not ETH. The second account deletion hides the recreated BTC from the latest view, while the historical read at 15 still returns "0.25".
Constraints:
  • At most 200,000 method calls, excluding construction.

  • Account IDs and asset names are nonempty strings of at most 64 characters.

  • Values are valid nonnegative decimal strings of at most 40 characters; no arithmetic or normalization is required.

  • Timestamps are integers in [1, 10^18]; mutation timestamps are globally strictly increasing. Query timestamps need not be increasing.

  • The total number of entries returned by all get_all calls is at most 200,000, but accounts may have many historical assets that are currently absent.

  • Execution is single-threaded; all history must remain queryable.


Follow-up:
How would you change the data structures if mutations could arrive out of timestamp order, while preserving historical account-deletion semantics and avoiding an asset scan on account deletion? Assume mutation timestamps remain globally unique.
Want to practise this one?
Create a free account to open the full question and practise Coinbase questions with AI.
Sign up free
system design Hard database #2

2. Design AssetConfigStore — versioned trading configuration with historical reads


Background
Coinbase Exchange supports many trading products, such as BTC-USD, whose operational configuration can change over time. Model an in-memory configuration component that lets trading-support tools retrieve current settings and lets incident investigators reconstruct settings at a historical timestamp. This is a practice adaptation of the reported Coinbase timestamped, two-level key-value-store exercise, not a description of Coinbase's internal implementation.
Requirements
1. Store string values under a product key and setting subkey. set creates a new version without destroying older versions. An empty string is a valid value and is different from a missing value.
2. Every mutation has an integer timestamp. Mutation timestamps must be strictly increasing across the entire store, including deletes of nonexistent entries. Reject an out-of-range or non-increasing mutation timestamp with ValueError, without changing any state.
3. Reads accept an optional timestamp. An omitted timestamp means the latest state; a supplied timestamp means the state after all mutations at or before that timestamp. Return None for a missing setting. Reads before the first mutation or after the last mutation are valid.
4. delete_subkey makes one setting absent from its timestamp onward. delete_key makes every setting under that product absent from its timestamp onward. Both preserve historical reads. A subsequent set recreates only the specified setting: it must not resurrect other deleted settings.
5. get_all returns a new dictionary containing only settings visible at the requested time. Return an empty dictionary for a product with no visible settings. Dictionary order is not significant, and modifying a returned dictionary must not change the store.
6. Use lazy product-deletion markers rather than scanning every setting during delete_key. Historical point reads must use binary search rather than scanning every version. Deletes of missing products or settings are valid mutations.
Class API
  • AssetConfigStore() — construct an empty store.

  • set(product: str, setting: str, value: str, timestamp: int) -> None — append a setting version.

  • get(product: str, setting: str, timestamp: Optional[int] = None) -> Optional[str] — retrieve the visible value at the requested time.

  • get_all(product: str, timestamp: Optional[int] = None) -> dict[str, str] — retrieve all visible settings for a product.

  • delete_subkey(product: str, setting: str, timestamp: int) -> None — append a setting-deletion marker.

  • delete_key(product: str, timestamp: int) -> None — append a product-deletion marker without visiting its settings.


Example 1:
Input sequence of method calls on a new store:
set("BTC-USD", "min_order", "0.0001", 10)
set("BTC-USD", "status", "online", 20)
set("BTC-USD", "min_order", "0.0002", 30)
get("BTC-USD", "min_order", 25)
delete_key("BTC-USD", 40)
get_all("BTC-USD", 35)
get_all("BTC-USD", 40)
set("BTC-USD", "status", "post_only", 50)
get_all("BTC-USD")

Output, one entry per call (null represents None):
[null, null, null, "0.0001", null, {"min_order": "0.0002", "status": "online"}, {}, null, {"status": "post_only"}]

Explanation: The update at 30 is not visible at 25. Deleting the product at 40 leaves its state at 35 intact. The write at 50 recreates status, but the older min_order remains deleted.
Example 2:
Input sequence of method calls on a new store:
set("ETH-USD", "notice", "", 5)
get("ETH-USD", "notice", 4)
get("ETH-USD", "notice", 5)
delete_subkey("ETH-USD", "notice", 8)
get("ETH-USD", "notice", 8)
set("ETH-USD", "notice", "maintenance", 12)
get_all("ETH-USD", 7)
get_all("ETH-USD", 10)
get_all("ETH-USD", 100)

Output:
[null, null, "", null, null, null, {"notice": ""}, {}, {"notice": "maintenance"}]

Explanation: The empty string is a present value at timestamps 5 through 7. The setting is absent from 8 through 11, then becomes maintenance at 12. A future read sees all mutations recorded so far.
Constraints
  • At most 200,000 API calls; product and setting names are nonempty strings of at most 100 characters, and values have at most 1,000 characters.

  • Supplied timestamps are integers in [0, 10^12]. Out-of-range read timestamps also raise ValueError. String arguments and argument types satisfy the stated bounds.

  • Calls execute sequentially in one process. Persistence, expiration, history compaction, and concurrency are out of scope.

  • Target amortized O(1) writes and deletions, excluding string hashing; product deletion must be independent of the number of settings. get_all may inspect every setting ever recorded for the product.

Start practicing Coinbase questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free