← HarveyAI Interview Insights

HarveyAI·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Interviewed for a software engineer role at HarveyAI and got a spreadsheet design question that looked manageable until the formula propagation part showed up.

Questions Asked (1)

Q1

Extend a spreadsheet's setCell method to support formula inputs like '=B1+5', where updating a cell must automatically propagate changes to all cells that reference it.

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

The basic setCell part was fine but the propagation piece tripped me up for a bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then propose a graph-based dependency model where cells are nodes and references are edges. Explain how setCell updates the cell's value or formula, recalculates dependents via topological order, and handles cycles. Discuss trade-offs between eager and lazy evaluation, and mention optimizations like memoization and dirty marking.

Pro tip: Demonstrate awareness of real-world spreadsheet challenges: circular references, error propagation, and performance at scale. Mention that HarveyAI likely values robust, scalable solutions, so discuss how your approach handles large dependency graphs efficiently.

1. Clarify Requirements and Assumptions

Ask about supported formula syntax, error handling, cycle detection, and performance expectations. Confirm whether updates should be immediate or lazy.

2. Design Data Structures

Represent cells with values/formulas, and maintain a dependency graph (e.g., adjacency lists) to track which cells depend on which. Consider reverse dependencies for efficient updates.

3. Implement setCell and Propagation

When setCell is called, update the cell, then recalculate all dependent cells in topological order. Use DFS/BFS to traverse dependents and detect cycles.

4. Handle Edge Cases and Errors

Detect circular references and propagate errors (e.g., #REF!, #CYCLE!). Ensure that invalid formulas don't crash the system and that errors propagate correctly.

5. Optimize and Discuss Trade-offs

Compare eager vs. lazy evaluation, discuss memoization, dirty marking, and incremental updates. Mention how to scale to large sheets with thousands of cells.

Key Points to Mention

  • Dependency graph representation (adjacency list, reverse edges)
  • Topological sorting for recalculation order
  • Cycle detection using DFS with visited states
  • Eager vs. lazy evaluation trade-offs
  • Error propagation and handling (e.g., #REF!, #CYCLE!)
  • Performance optimizations: memoization, dirty marking, incremental updates

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