OpenAI

Verified interview challenge

Recalculate spreadsheet formulas

Keep spreadsheet results correct as values change and formulas introduce or replace dependencies.

Unlock with Full Access

The 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.

Your coding workspacePreview
solution.pyPython 3.13
def spreadsheet_results(
    operations
):
    # Your implementation goes here
    pass
Test cases

Run your code to see results.

Full instructions, starter code and test cases included with Full Access.