← Coinbase Interview Insights

Coinbase·Software Engineer·Technical Phone Screen·Senior

SeniorPrefer not to say
Jul 2026Remote

Summary

Coinbase SWE interview with a meaty in-memory system design coding problem. The whole session was basically one big question about building a task management system from scratch, with layers added as you went. Felt like a LeetCode-style OOP problem but with enough edge cases to keep you honest.

Questions Asked (4)

Q1

Design and implement an in-memory task management system supporting task CRUD, priority-based listing, user quotas, task assignment with TTL, and completion/expiration rules.

System DesignData ModelingAlgorithms & Data Structures
Author's notes

This is one of those problems that looks like a data structures question but is really about keeping your design clean under pressure.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then design the data model and core operations (CRUD, priority listing, quotas, assignment with TTL, completion/expiration). Walk through the implementation using appropriate data structures, and discuss trade-offs, edge cases, and potential optimizations.

Pro tip: Emphasize how you handle concurrency and consistency, especially around TTL expiration and quota enforcement, as these are critical in a financial services context like Coinbase.

1. Clarify Requirements

Ask questions to understand expected scale, concurrency, persistence needs, and exact semantics of priority, quotas, TTL, and expiration rules.

2. Design Data Model

Define entities (Task, User, Assignment) and choose data structures (e.g., hash maps, priority queues, heaps) to support efficient operations.

3. Implement Core Operations

Detail algorithms for CRUD, priority-based listing, quota checks, assignment with TTL, and handling completion/expiration.

4. Address Edge Cases and Concurrency

Discuss race conditions, thread safety, TTL cleanup strategies, and quota enforcement under concurrent access.

5. Analyze Trade-offs and Optimizations

Evaluate time/space complexity, scalability, and potential improvements like lazy expiration or indexing.

Key Points to Mention

  • Choice of data structures: priority queue (heap) for priority listing, hash map for O(1) task lookup, and TTL management via timestamps or delay queues.
  • Quota enforcement: per-user task limits, atomic checks, and potential need for distributed counters if scaling beyond single node.
  • TTL and expiration: lazy vs. active expiration, handling expired assignments, and ensuring tasks become available again.
  • Concurrency: thread safety using locks, concurrent data structures, or actor model; avoiding race conditions in quota and assignment.
  • Completion rules: marking tasks complete, updating user quotas, and removing from priority queue efficiently.
  • Scalability and persistence: in-memory limitations, potential need for persistence, and how design would extend to distributed systems.

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

Q2

Return the top N tasks by priority, and also return the top N tasks by priority whose name contains a given substring.

Algorithms & Data Structures
Author's notes

Straightforward once you know whether you're ranking tasks or assignments.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem requirements: whether the two queries are independent or if the filtered result should be a subset of the top N. Then propose an efficient solution using a priority queue (min-heap) to find the top N tasks by priority, and for the filtered query, either filter first then heapify or use a heap with a custom comparator that ignores non-matching tasks. Discuss trade-offs between sorting, heap, and quickselect approaches.

Pro tip: Mention that if the substring filter is highly selective, filtering first can reduce the heap size and improve performance; otherwise, a single pass with a heap that only considers matching tasks avoids scanning the data twice.

1. Clarify requirements and constraints

Ask whether the two results are independent or if the filtered result should be a subset of the top N. Also confirm the definition of 'top' (e.g., highest priority value) and whether ties matter.

2. Choose data structures

Decide between sorting the entire list (O(n log n)) or using a min-heap of size N (O(n log N)) for the top N. For the filtered query, consider filtering first or using a heap that only processes matching tasks.

3. Design the algorithm

For the first query: iterate through tasks, maintain a min-heap of size N, and replace the root if a task has higher priority. For the second query: either filter tasks by substring then apply the same heap logic, or modify the heap to skip non-matching tasks.

4. Analyze complexity and edge cases

Discuss time and space complexity: O(n log N) time and O(N) space for the heap approach. Handle edge cases like N=0, N > number of tasks, empty substring, and case sensitivity.

5. Optimize and discuss trade-offs

If N is small, heap is efficient; if N is large, sorting might be simpler. For the filtered query, if the substring is very selective, filtering first can be faster. Mention that quickselect can achieve O(n) average time for top N.

Key Points to Mention

  • Use a min-heap of size N to efficiently find the top N tasks by priority in O(n log N) time.
  • For the filtered query, clarify whether to filter first or integrate the substring check into the heap logic.
  • Consider edge cases: N=0, N > total tasks, empty substring, case sensitivity, and ties in priority.
  • Discuss alternative approaches like sorting (O(n log n)) or quickselect (O(n) average) and their trade-offs.
  • Mention that the filtered result might be a subset of the top N, which could change the algorithm design.
  • Highlight the importance of clarifying requirements before coding, especially in an interview setting.

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

Q3

Implement task assignment with TTL: assign a task to a user at a given startTime with a duration, enforce user quota limits on active assignments, and support listing a user's active assignments at time t.

System DesignData ModelingTechnical Trade-offs
Author's notes

The quota check was where I slipped up first.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and scale, then design a data model that efficiently supports TTL-based expiration and quota enforcement. Discuss trade-offs between eager vs lazy expiration and propose an API for assignment and listing with time-based queries.

Pro tip: Emphasize that TTL should be enforced at read time to avoid background job overhead, but also consider a cleanup process for storage efficiency. Mention that quota checks must be atomic to prevent race conditions in concurrent assignments.

1. Clarify Requirements and Scale

Ask about expected read/write ratios, number of users, tasks, and whether assignments can be modified or cancelled. Confirm if TTL is strictly duration-based or can be extended.

2. Design Data Model

Propose a schema for assignments with fields like userId, taskId, startTime, endTime (startTime + duration), and status. Consider indexing on userId and endTime for efficient active assignment queries.

3. Implement Assignment with Quota Check

Outline an atomic operation to check current active assignments count against quota and insert new assignment if within limit. Use transactions or conditional writes to handle concurrency.

4. Handle TTL and Expiration

Explain that active assignments are those where startTime <= t < endTime. For cleanup, discuss lazy deletion on read or a periodic job to remove expired assignments.

5. List Active Assignments

Design a query that filters by userId and time t, using an index on (userId, startTime, endTime) to quickly retrieve active assignments. Discuss pagination if needed.

Key Points to Mention

  • Atomicity of quota check and assignment insertion to prevent over-assignment.
  • Indexing strategy for efficient time-range queries (e.g., composite index on userId and endTime).
  • Trade-offs between eager (background cleanup) and lazy (on-read) TTL enforcement.
  • Handling of concurrent requests and potential race conditions.
  • Scalability considerations: sharding by userId, caching active counts.
  • API design: assignTask(userId, taskId, startTime, duration), listActiveAssignments(userId, t).

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

Q4

Implement task completion: allow completing a task for a user at time t, prevent completing an expired assignment, and when multiple active assignments exist for the same user-task pair, complete the one with the earliest startTime.

Algorithms & Data StructuresSystem Design
Author's notes

The 'earliest startTime' tiebreaker for completions is the kind of thing you either get right or you don't.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the data model and requirements first, then design an efficient data structure to manage assignments and support the completion operation. Focus on the selection logic for multiple active assignments and handle edge cases like expired assignments and time-based validity.

Pro tip: Discuss trade-offs between different data structures (e.g., priority queue vs. sorted list) and mention how you would handle concurrency in a real system. Also, consider idempotency and error handling for invalid completions.

1. Clarify requirements and assumptions

Ask questions to understand the data model: what defines an assignment (startTime, expiration, status), how tasks and users are identified, and what 'expired' means. Confirm that completing a task should mark the assignment as completed and prevent further completions.

2. Design data structures

Propose a data structure to store assignments, such as a map from (user, task) to a collection of assignments. For efficient retrieval of the earliest startTime among active assignments, consider using a min-heap or a sorted list keyed by startTime.

3. Implement completion logic

Outline the algorithm: given user, task, and time t, retrieve all active assignments for that pair. Filter out expired ones (e.g., where t > expiration). If multiple remain, select the one with the earliest startTime. Mark it as completed and update the data structure.

4. Handle edge cases and errors

Address scenarios like no active assignments, all expired, or already completed. Define appropriate return values or exceptions. Consider concurrency: use locks or atomic operations to prevent race conditions.

5. Analyze complexity and scalability

Discuss time and space complexity of the operations. For example, if using a heap per (user, task), completion is O(log n) for finding and removing the earliest. Mention how this scales with many users and tasks.

Key Points to Mention

  • Data model: assignments have startTime, expiration, status; tasks and users are identified by unique IDs.
  • Selection criteria: among active assignments, choose the one with the earliest startTime; if ties, any (or specify tie-breaker).
  • Expiration check: an assignment is expired if current time t is after its expiration time; such assignments should not be completed.
  • Efficient data structure: use a priority queue (min-heap) per (user, task) to quickly access the earliest startTime.
  • Concurrency: in a distributed system, use optimistic locking or transactions to ensure atomic completion.
  • Idempotency: completing an already completed assignment should be handled gracefully (e.g., return error or no-op).

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