← Coinbase Interview Insights

Coinbase·Software Engineer·Technical Phone Screen·Senior

SeniorPrefer not to say
Apr 2026

Summary

Coinbase OOD round focused on a cloud storage design problem with some tricky extensions thrown in mid-question. The base problem felt manageable but the follow-up variants added real complexity fast.

Questions Asked (2)

Q1

Design a cloud storage system with user management. Implement add_user and then update_capacity(user), where reducing a user's capacity below their current usage triggers automatic file deletion from largest to smallest until usage fits within the new limit.

System DesignAlgorithms & Data StructuresData Modeling
Author's notes

The base add_user part was fine, just bookkeeping.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify requirements and constraints first, then design a data model with User and File entities, and outline the add_user and update_capacity operations. For update_capacity, use a max-heap or sorted structure to efficiently delete largest files until usage fits, discussing time/space complexity and edge cases.

Pro tip: Demonstrate awareness of real-world concerns like atomicity, concurrency, and data durability—mention how you'd handle concurrent updates or persist deletions to avoid data loss.

1. Clarify Requirements

Ask about scale, consistency needs, and whether deletions are permanent or soft. Confirm that update_capacity should delete largest files first and that usage is tracked per user.

2. Design Data Model

Define User with id, capacity, and usage, and File with id, size, and owner. Consider storing files in a max-heap per user for efficient largest-file retrieval.

3. Implement add_user

Create a new user with given capacity and zero usage, initializing an empty file collection. Discuss ID generation and storage.

4. Implement update_capacity

Update capacity; if new capacity < usage, repeatedly remove the largest file from the heap, subtract its size from usage, and delete it until usage <= capacity. Handle edge cases like no files or capacity below zero.

5. Analyze and Optimize

Analyze time complexity: O(k log n) for k deletions with heap. Discuss alternatives like balanced BST or sorted list, and trade-offs. Mention concurrency and persistence.

Key Points to Mention

  • Use a max-heap or priority queue per user to efficiently retrieve and delete largest files.
  • Track total usage per user and update it on file additions/deletions.
  • Handle edge cases: capacity reduction below zero, no files to delete, and partial deletions.
  • Discuss time and space complexity: O(k log n) for k deletions, O(n) space for files.
  • Address concurrency: use locks or transactions to prevent race conditions during capacity updates.
  • Consider persistence and durability: log deletions or use a database to ensure data integrity.

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

Q2

Extend the cloud storage design to support compress_file and decompress_file operations. Compressing renames the file to file_name.compressed and halves its size; decompressing reverses both. You need to handle cases where the user or file doesn't exist, and enforce that a file can't be compressed twice or decompressed if it isn't compressed.

System DesignTechnical Trade-offsData Modeling
Author's notes

This one tripped me up more than I expected.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the existing cloud storage design and then extend it by adding compress_file and decompress_file operations with proper validation and state management. Focus on handling edge cases, maintaining data integrity, and discussing trade-offs such as atomicity and concurrency.

Pro tip: Demonstrate maturity by discussing how to handle concurrent operations and ensure atomicity, perhaps using transactions or locks, and mention idempotency to avoid partial failures.

1. Clarify Requirements and Assumptions

Restate the problem and confirm assumptions about the existing system, such as how files are stored and accessed, and what 'size' means (e.g., logical vs. physical).

2. Define Data Model Changes

Determine what metadata needs to be stored to track compression state, such as a 'compressed' flag or file extension, and how renaming affects file references.

3. Design Operations with Validation

Outline the steps for compress_file and decompress_file, including checks for user existence, file existence, and current compression state, and specify error responses.

4. Address Concurrency and Atomicity

Discuss how to handle concurrent requests, ensuring that operations are atomic and that race conditions (e.g., two simultaneous compressions) are prevented.

5. Discuss Trade-offs and Extensions

Mention trade-offs like storage overhead for metadata, performance implications, and potential extensions such as compression levels or async processing.

Key Points to Mention

  • Validation: check user and file existence, and enforce compression state (not already compressed for compress, compressed for decompress).
  • Atomicity: ensure rename and size update happen atomically to avoid inconsistent state.
  • Concurrency: use locks or transactions to prevent race conditions, e.g., two compress requests on the same file.
  • Error handling: return appropriate errors (e.g., 404 for missing file, 409 for invalid state) and consider idempotency.
  • Data model: store compression status in metadata, possibly using a flag or file extension, and update references accordingly.
  • Trade-offs: discuss performance impact of compression, storage savings, and potential need for background processing.

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