← 返回 openai 的题目列表Spreadsheet Implementation with Cycle Detection and Caching
类型:online_judge
openai
Implement a simple spreadsheet system. You need to implement two functions getCell(row: int, col: int) -> int and setCell(row: int, col: int, value: int) -> None. You must handle cycles in the sheet. You are expected to write tests. The first part is acceptable with a sub-optimal getCell implementation where the value is computed on the fly. In the second part, the setCell function should update the values of impacted cells so that getCell is O(1).
Example
Input
1 setCell 1 1 10
2 getCell 1 1