CodePark/ problems / Mini spreadsheet
START PRACTICINGPRACTICE
Coding problem · Practical class design › Graphs and dependencies

Mini spreadsheet

hardabout 45 minutes in an interview

Build a tiny spreadsheet engine as a Spreadsheet class.

new Spreadsheet() starts with every cell empty. A cell name is one or more uppercase letters followed by one or more digits, like A1, B12 or AA3. An empty cell has the value 0.

Input: s.set("A1", "2"); s.set("B1", "3"); s.set("C1", "=A1+B1+10") s.get("C1") Output: 15
Input: s.set("A1", "7") s.get("C1") Output: 20C1 updates when A1 changes

It comes in 3 parts, each building on the last: Values and formulas, Who depends on a cell, Reject cycles.