Verified interview challenge
Recalculate spreadsheet formulas
Keep spreadsheet results correct as values change and formulas introduce or replace dependencies.
Unlock with Full AccessThe challenge
Build a small spreadsheet engine that supports values, sum formulas and reads. A change to one cell can affect several others through a chain of references. Formula updates must also be checked for cycles, and a rejected update must leave the spreadsheet unchanged.
What you'll practise
Dependency tracking
Represent which cells depend on others as formulas are created and replaced.
Recalculation
Return current values after direct and transitive upstream changes.
Cycle handling
Reject circular formulas without leaving behind a partially changed spreadsheet.
def spreadsheet_results(
operations
):
# Your implementation goes here
passRun your code to see results.