Question
Evaluate a tiny spreadsheet. You are given a dict mapping cell names (e.g. 'A1') to formula strings. A formula is either a number (e.g. '5'), a cell reference (e.g. 'A2'), or a sum of operands joined by '+', where each operand is a number or a cell reference (e.g. 'A1+B2+3'). Resolve every cell to its integer value, following references. Return a dict mapping each cell name to its value. There are no cycles, and every referenced cell exists.
eval_spreadsheet(cells: dict[str,str]) → dict[str,int][{"A1":"5","A2":"A1+3","A3":"A1+A2"}]out{"A1":5,"A2":8,"A3":13}State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.