← Coinbase Interview Insights

Coinbase·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Apr 2026

Summary

Coinbase software engineer interview with a brutal coding question that involved building out a key-value store with user-based locking. Spent way too long on it and still didn't get all the test cases passing.

Questions Asked (1)

Q1

Implement a key-value store with user-based locking: support setByUser, deleteByUser, lock, and unlock operations, where only the user who locked a key can modify it.

Algorithms & Data StructuresSystem DesignTechnical Trade-offs
Author's notes

Spent over 50 minutes on this and still had 4 test cases failing at the end.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the requirements and constraints first, then design a data structure that combines a hash map for key-value storage with per-key metadata for locking. Implement the operations with proper synchronization to handle concurrent access, and discuss trade-offs around consistency, scalability, and failure handling.

Pro tip: Emphasize that locking is per-key and user-specific, and discuss how to handle edge cases like lock expiration and reentrancy. Also, mention that in a distributed setting, you'd need a consensus protocol or a centralized lock service to avoid race conditions.

1. Clarify Requirements

Ask about expected scale, concurrency, persistence, and whether the store is in-memory or distributed. Confirm that only the locking user can modify the key, and whether locks expire or can be forcibly released.

2. Design Data Structures

Propose a hash map for key-value storage and a separate map for lock metadata (e.g., key -> {userId, timestamp}). Consider using a concurrent hash map or adding synchronization for thread safety.

3. Implement Operations

Define setByUser and deleteByUser to check lock ownership before modifying. Implement lock to set the lock if not already locked, and unlock to clear it only if the requester is the owner.

4. Handle Concurrency and Edge Cases

Use locks or atomic operations to prevent race conditions. Discuss handling of lock timeouts, reentrant locks, and error responses for unauthorized access.

5. Discuss Trade-offs and Scalability

Compare in-memory vs. distributed implementations, and mention consistency models (e.g., strong vs. eventual). Highlight potential bottlenecks and solutions like sharding or using Redis with Lua scripts.

Key Points to Mention

  • Thread safety and synchronization mechanisms (e.g., mutexes, concurrent data structures)
  • Lock ownership validation and error handling for unauthorized operations
  • Lock expiration and cleanup to prevent deadlocks
  • Scalability considerations: sharding, distributed locking (e.g., Redis, ZooKeeper)
  • Consistency and durability trade-offs (e.g., ACID vs. BASE)
  • API design: method signatures, return types, and error codes

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