← Coinbase Interview Insights

Coinbase·Software Engineer·Onsite - Coding / Algorithms·Intermediate

Intermediate
Apr 2026

Summary

Coinbase software engineer interview with a coding round built around an in-memory order management system for crypto trades. The problem looked manageable at first glance but the constraints pushed you toward thinking carefully about data structure choices rather than just getting something working.

Questions Asked (1)

Q1

Design and implement an in-memory crypto order management system that parses commands from stdin. Orders have an id, symbol, side, quantity, and state (LIVE, PAUSED, CANCELLED). Support CREATE, PAUSE, RESUME, CANCEL, GET, and COUNT commands, printing output for queries and ERROR for invalid operations or bad state transitions. The system needs to handle up to 200,000 commands efficiently.

Algorithms & Data StructuresSystem DesignData Modeling
Author's notes

The problem itself is not crazy hard but the scale hint is what tripped me up at first.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and edge cases, then propose a design using a hash map for O(1) order lookups and a state machine to enforce valid transitions. Implement the command parser and handlers, ensuring efficient I/O and error handling, and test with large inputs to verify performance.

Pro tip: Mention that you'll use a fast I/O method like buffered reading to handle 200,000 commands within time limits, and consider using an enum for order states to make transitions explicit and less error-prone.

1. Clarify requirements and edge cases

Ask about command format, output expectations, and constraints like duplicate IDs or invalid symbols. Confirm the exact state transition rules and error conditions.

2. Design data structures and state machine

Propose using a hash map (e.g., unordered_map) to store orders by ID for O(1) access. Define a state machine with allowed transitions (e.g., LIVE->PAUSED, PAUSED->LIVE, LIVE->CANCELLED, PAUSED->CANCELLED) and reject others.

3. Implement command parsing and handlers

Write a parser that reads commands line by line, tokenizes them, and dispatches to appropriate handlers. For each command, validate inputs, update state, and produce output (e.g., order details for GET, count for COUNT, ERROR for invalid).

4. Optimize for performance and test

Use fast I/O (e.g., ios::sync_with_stdio(false) in C++) and ensure operations are O(1). Test with large inputs to verify speed and correctness, and handle edge cases like missing orders or invalid transitions.

Key Points to Mention

  • Use a hash map for O(1) order lookup and update.
  • Implement a state machine to enforce valid transitions and return ERROR for invalid ones.
  • Handle command parsing efficiently with tokenization and fast I/O.
  • Consider memory usage: store only necessary fields per order.
  • Ensure COUNT returns the number of orders in each state (or total, depending on interpretation).
  • Test with 200,000 commands to ensure performance within limits.

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