← Box Interview Insights

Box·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Box technical phone screen for a software engineering role. One meaty design question that took up the whole session, which I didn't expect. Walked away thinking I probably over-engineered parts of it.

Questions Asked (1)

Q1

Design and implement an in-memory key-value store that supports transactions, including nested transactions, with SET, GET, UNSET, BEGIN, COMMIT, and ROLLBACK operations.

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

The nested transactions part is where I got tripped up.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then propose a design using a stack of transaction layers where each layer tracks changes relative to its parent. Implement the core operations with careful attention to nested transaction semantics, and discuss trade-offs between simplicity and efficiency.

Pro tip: Demonstrate maturity by discussing how to handle edge cases like rollback of a transaction that has already been committed or nested rollbacks, and mention that you would write unit tests for these scenarios.

1. Clarify Requirements and Constraints

Ask questions to understand expected scale, concurrency needs, and whether transactions are isolated. Confirm that nested transactions should support independent commit/rollback.

2. Design Data Structures

Propose using a stack of transaction layers, each with a map for local changes and a reference to its parent. The base layer represents the committed state.

3. Implement Core Operations

For SET/UNSET, record changes in the current transaction layer. For GET, search from the top of the stack down to the base. BEGIN pushes a new layer, COMMIT merges the top layer into its parent, and ROLLBACK discards the top layer.

4. Handle Edge Cases and Complexity

Discuss behavior when committing/rolling back without an active transaction, and analyze time/space complexity. Consider optimizations like lazy propagation or copy-on-write.

5. Discuss Trade-offs and Testing

Compare alternative designs (e.g., undo logs, versioning) and explain why the stack approach is suitable. Mention testing strategies for nested transactions.

Key Points to Mention

  • Nested transaction semantics: each BEGIN creates a new scope; COMMIT merges changes to parent; ROLLBACK discards current scope.
  • Data structure choice: stack of maps (or similar) to track changes per transaction level.
  • GET operation must traverse from innermost to outermost transaction to find the latest value.
  • Time complexity: O(1) for SET/UNSET, O(depth) for GET, O(1) for BEGIN/COMMIT/ROLLBACK (amortized for COMMIT if merging).
  • Edge cases: rollback/commit with no active transaction, nested rollback affecting only current level.
  • Trade-offs: memory overhead vs. simplicity; alternative approaches like undo logs or persistent data structures.

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