Back to problems

Spreadsheet Implementation with Cycle Detection and Caching

Object-Oriented Programming · OpenAI · Medium

Design a minimal spreadsheet where cells are addressed by integer row and column numbers. Each cell can hold either a literal integer or a reference formula pointing to another cell. Implement two methods: int getCell(int row, int col) – retrieves the cell’s evaluated integer. If the cell stores a formula, follow the reference recursively until a raw integer is found; if during evaluation a cycle is encountered, raise an error. void setCell(int row, int col, String content)…

Checking your access…