Skip to content
Discussion options

You must be logged in to vote

We need to design a spreadsheet class that supports setting cell values, resetting cell values, and evaluating formulas that sum two operands, which can be either cell references or integers. The key challenge is efficiently managing cell values and parsing formulas to compute the sum correctly.

Approach

  1. Initialization: The spreadsheet is initialized with a specified number of rows and 26 columns (A-Z). All cells start with a value of 0.
  2. Storing Cell Values: Use a hash map (associative array in PHP) to store cell values where the key is the cell reference (e.g., "A1") and the value is the integer stored in that cell.
  3. Setting Cells: When setting a cell, update its value in the hash map.
  4. R…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@kovatz
Comment options

kovatz Sep 19, 2025
Collaborator

@mah-shamim
Comment options

mah-shamim Sep 19, 2025
Maintainer Author

Answer selected by kovatz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested medium Difficulty
2 participants