← Harvey Interview Insights

Harvey·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Jun 2026

Summary

Coding round at HarveyAI for a software engineer role. The problem was a spreadsheet cell dependency thing, conceptually close to a well-known OpenAI question, and I almost finished but ran out of time one line short.

Questions Asked (1)

Q1

Design a spreadsheet system where cells can depend on other cells, and reads must be O(1).

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

I was one line away from finishing.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then propose a design that separates the dependency graph from the value storage. Use topological sorting to evaluate cells in order and maintain a cache of computed values so that reads are O(1). Discuss trade-offs between eager and lazy evaluation, and how to handle updates efficiently.

Pro tip: Demonstrate awareness of real-world spreadsheet complexities like circular dependencies and incremental updates, and suggest a hybrid approach that balances read and write performance.

1. Clarify Requirements

Ask about expected read/write patterns, cell count, update frequency, and whether formulas can change. This shows you think about practical constraints before diving into design.

2. Model Dependencies

Represent cells as nodes in a directed graph, where edges indicate dependencies. Use adjacency lists to track both dependents and dependencies for efficient updates.

3. Ensure O(1) Reads

Maintain a cache (e.g., hash map) of computed cell values. On read, simply return the cached value, achieving O(1) time complexity.

4. Handle Writes and Recalculation

When a cell changes, update its value and propagate changes to dependents. Use topological sorting to determine evaluation order and avoid redundant computations.

5. Address Edge Cases and Trade-offs

Discuss circular dependency detection, incremental updates, and trade-offs between eager (recompute on write) and lazy (recompute on read) evaluation strategies.

Key Points to Mention

  • Directed acyclic graph (DAG) for dependencies
  • Topological sorting for evaluation order
  • Caching computed values for O(1) reads
  • Handling circular dependencies with cycle detection
  • Trade-offs between eager and lazy evaluation
  • Incremental updates and dirty marking for efficiency

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