Software Engineer • Senior-Level
Software Engineer • Senior-Level
High QualityPrep Other Coding Questions Asked by Harvey
Continue with targeted prep from Harvey's coding question bank.
Interview Summary
The Harvey phone screen asked me to implement a small spreadsheet / formula engine.
The problem started with basic integer cells, then added formulas referencing other cells, dependency propagation, and circular-reference detection. One important requirement was that get_cell() should remain O(1), which means formulas should be evaluated and dependent cells updated during set_cell() rather than recomputed when they are read.
Interview Details
Part 1 — Basic Spreadsheet Cells
Implement two APIs:
set_cell(label, value)get_cell(label)
Cell labels consist of column letters followed by row digits, such as: A1, B10. Initially, values are just integers. A natural representation is a hash map: cell label -> resolved value. For cells that have never been assigned, the exact behavior should be clarified with the interviewer, such as returning None or raising an error.
Part 2 — Formulas and Cell References
Next, cells can contain formulas. Only addition is required. For example: set_cell("A1", "10"), set_cell("A2", "A1+20"). Then: get_cell("A2") == 30. Another example: set_cell("A3", "A1+A2+5") Then: get_cell("A3") == 45. Some versions of the problem use a leading =: set_cell("A1", "=B1+C1+1"). Constant-only expressions are also valid: set_cell("A1", "=1+2")
A formula may therefore contain:
- Cell references
- Integer constants
- Addition operators
No subtraction, multiplication, or division is required.
-
Dependency Propagation
When one cell
Unlock Full Details
Create a free account to unlock this interview experience report.