← Coinbase Interview InsightsSoftware Engineer

Coinbase·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Jun 2026

Summary

Coinbase software engineer interview with a brutal coding question that ate up most of the session. The problem was way more involved than expected and I left with failing test cases, which didn't feel great.

Questions Asked (1)

Q1

Implement a key-value store with user-based locking: a user can lock a key, the locking user can still read and write to it, but other users are blocked from modifying it. You need to implement setByUser, deleteByUser, lock, and unlock.

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

Start by clarifying the requirements and constraints, then propose a design using a hash map for key-value storage and a separate lock manager that tracks which user holds the lock on each key. Implement the operations with proper synchronization to ensure thread safety, and discuss trade-offs such as lock granularity and potential deadlocks.

Pro tip: Mention that locks should be automatically released when the user session ends or after a timeout to prevent indefinite blocking, and consider using a read-write lock per key to allow concurrent reads while ensuring exclusive writes.

1. Clarify Requirements

Ask about concurrency expectations, persistence, lock timeout, and whether locks are exclusive to a single user or can be shared. Confirm the exact semantics of setByUser, deleteByUser, lock, and unlock.

2. Design Data Structures

Propose a hash map for key-value storage and a separate map for locks, where each key maps to the user ID holding the lock. Consider using a concurrent hash map or adding synchronization for thread safety.

3. Implement Operations

For setByUser and deleteByUser, check if the key is locked by another user; if so, reject the operation. For lock, atomically set the lock if not already held; for unlock, verify the user and release the lock.

4. Handle Concurrency and Edge Cases

Use fine-grained locking (e.g., per-key locks) to avoid bottlenecks. Discuss handling of lock timeouts, reentrancy, and potential deadlocks. Ensure atomicity of check-and-set operations.

5. Discuss Trade-offs and Extensions

Talk about trade-offs between simplicity and scalability, and mention possible extensions like distributed locking, persistence, or lock expiration.

Key Points to Mention

  • Thread safety and synchronization mechanisms (e.g., mutexes, read-write locks)
  • Lock ownership and user identification
  • Atomicity of lock acquisition and release
  • Handling of lock timeouts and automatic release
  • Scalability considerations for high concurrency
  • Potential deadlocks and mitigation strategies

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