Problem
Build an in-memory spreadsheet. set(cell, expr) stores a literal number or a formula like "=A1+A2" (cell references and + only). get(cell) returns the evaluated integer value, recomputed from current inputs. Updating an input must be reflected by later reads.
Restate the problem in one sentence and list the edge cases — before writing any code.
Then keep talking — restate the problem + the edge cases in your own words.
“Let me make sure I understand the problem, then I'll walk through my approach.”
checking microphone…
Self-check
Hints / what this doesn't test
This is an Opendoor-flavored applied problem: a small system with state and
recomputation, not a puzzle. Restate it back before coding — "So a cell is
either a number or a +-formula over other cells, and get always reflects the
latest inputs?"
What this problem does not test (say so out loud): multiplication / operator
precedence, ranges like A1:A3, and cycle handling are out of scope here — but a
senior names the cycle case (A1=B1, B1=A1) as a known gap and how they'd
detect it (visited-set during evaluation).
Tests
- ○literal
- ○formula_sum
- ○chained
- + 1 hidden test — revealed once the visible ones pass