← Coinbase Interview Insights

Coinbase·Software Engineer·Technical Phone Screen·Senior

SeniorPrefer not to say
May 2026

Summary

Coinbase software engineer interview with a pretty meaty system design question centered on a food delivery platform. One long problem broken into three parts, each building on the last. Not the hardest thing I've ever seen but there's enough surface area to trip you up if you're not careful about scope.

Questions Asked (3)

Q1

Given a set of restaurants (each with a menu, item prices, and a geographic location) and a stream of incoming orders, implement a way to find: (a) the restaurant that can fulfill a given set of menu items at the lowest total price, and (b) the restaurant geographically closest to the user.

Algorithms & Data StructuresSystem DesignData Modeling
Author's notes

I jumped straight into the geo part because it felt more interesting, which was probably the wrong move.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify requirements and constraints first, then propose a data model and algorithms for both queries. For lowest total price, consider indexing menus and using a min-heap or precomputed combinations; for closest restaurant, use a spatial index like a k-d tree or geohash. Discuss trade-offs between precomputation and on-the-fly computation, and how to handle streaming orders.

Pro tip: Mention that for Coinbase, low-latency and high-throughput are critical, so caching frequent queries and using in-memory data stores (e.g., Redis) for spatial indexes can be a game-changer. Also, consider partitioning by geography to scale.

1. Clarify Requirements and Constraints

Ask about scale (number of restaurants, orders per second), latency requirements, consistency needs, and whether the set of menu items is arbitrary or limited. Clarify if prices can change and how often.

2. Design Data Model and Indexes

Propose a schema: restaurants with menus (item->price), and location (lat/long). For price queries, index items to restaurants; for location, use a spatial index (e.g., R-tree, geohash). Consider denormalization for fast reads.

3. Algorithm for Lowest Total Price

For a given set of items, find restaurants that have all items and compute total price. Use inverted index from item to restaurants, intersect sets, and compute sums. Optimize with precomputed combinations if item sets are limited.

4. Algorithm for Closest Restaurant

Use a spatial index to find nearest restaurant to user's location. For streaming orders, maintain a dynamic index or use a geohash-based lookup with neighbor cells.

5. Handle Streaming and Scale

Discuss how to handle incoming orders: update indexes if restaurants change, cache frequent queries, and shard by geography. Consider using a distributed system with eventual consistency if needed.

Key Points to Mention

  • Trade-offs between precomputation and on-the-fly computation for price queries.
  • Use of spatial indexing (e.g., k-d tree, R-tree, geohash) for nearest neighbor search.
  • Inverted index for menu items to quickly find restaurants that can fulfill an order.
  • Caching strategies (e.g., Redis) for low-latency responses.
  • Sharding/partitioning by geography to scale horizontally.
  • Handling dynamic updates (price changes, restaurant closures) in a streaming environment.

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

Q2

Given a list of orders and their item prices, compute the following over a specified time window: total revenue, number of orders, and average order value.

Algorithms & Data StructuresProduct Analytics & Metrics
Author's notes

Easier than the other parts.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the input format, time window boundaries, and definitions (e.g., revenue per order, handling of refunds). Then outline an efficient algorithm, such as sorting orders by timestamp and using a sliding window or prefix sums, and discuss how to compute the three metrics in one pass. Finally, analyze time and space complexity and consider edge cases like empty windows or invalid data.

Pro tip: At Coinbase, data accuracy and real-time processing are critical. Mention that you would validate the time window boundaries (inclusive/exclusive) and consider using a streaming approach for large-scale data, showing awareness of production constraints.

1. Clarify requirements and assumptions

Ask about the input format (e.g., list of orders with timestamps and prices), time window definition (inclusive/exclusive), and whether refunds or discounts affect revenue. Confirm the output format and any constraints.

2. Choose an efficient algorithm

Propose sorting orders by timestamp and using a sliding window or prefix sums to compute metrics in O(n log n) time due to sorting, or O(n) if already sorted. Alternatively, use a single pass with a hash map if the window is fixed.

3. Compute metrics in one pass

Iterate through orders within the window, accumulating total revenue and order count, then derive average order value as revenue divided by count. Handle division by zero if no orders.

4. Analyze complexity and edge cases

Discuss time and space complexity, and address edge cases such as empty window, orders exactly on boundaries, negative prices (refunds), and large datasets requiring streaming.

5. Test with examples

Walk through a small example to verify correctness, including boundary conditions and expected outputs.

Key Points to Mention

  • Time window boundaries: inclusive vs exclusive, and handling orders exactly at the start/end.
  • Data structures: sorting, sliding window, prefix sums, or hash maps for efficient computation.
  • Time and space complexity: O(n log n) with sorting, O(n) if already sorted or using streaming.
  • Edge cases: empty window, zero orders, refunds/negative amounts, and large-scale data.
  • Definition of revenue: sum of item prices per order, and whether to include discounts or fees.
  • Average order value: total revenue divided by number of orders, with handling for division by zero.

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

Q3

Over the same time window, return the top-K orders ranked by total price, and the top-K menu items ranked by transaction volume.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This is where I stumbled a bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the data model and constraints first, then propose an efficient algorithm using hash maps for aggregation and heaps for top-K selection. Discuss trade-offs between time/space complexity and scalability, and consider edge cases like ties and large data volumes.

Pro tip: Mention that you would use a min-heap of size K for each ranking to achieve O(n log K) time, and highlight that this is optimal for streaming data. Also, discuss how to handle ties by defining a secondary sort key (e.g., order ID or item name) to ensure deterministic results.

1. Clarify requirements and constraints

Ask about data size, time window definition, whether K is fixed, and if ties need special handling. Confirm input format and expected output.

2. Design aggregation strategy

Use hash maps to aggregate total price per order and transaction volume per menu item within the time window. Consider if data fits in memory or needs streaming.

3. Select top-K efficiently

For each ranking, use a min-heap of size K to keep the top K elements. Iterate through aggregated data, pushing and popping to maintain the heap.

4. Handle ties and output format

Define a tie-breaking rule (e.g., by ID) and ensure the output is sorted descending by the ranking metric. Return two separate lists.

5. Analyze complexity and trade-offs

Discuss time complexity O(n log K) and space O(n + K). Compare with alternative approaches like sorting all items (O(n log n)) and explain why heap is better for large n and small K.

Key Points to Mention

  • Time complexity: O(n log K) using heaps vs O(n log n) using full sort
  • Space complexity: O(n) for aggregation maps plus O(K) for heaps
  • Handling ties with a deterministic secondary sort key
  • Scalability: streaming approach if data doesn't fit in memory
  • Edge cases: empty window, K larger than number of items, negative prices
  • Data structures: hash maps for aggregation, min-heaps for top-K

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