1p3a Question · Oct 2025 · USA

Sigma Computing Onsite Second Round Interview Experience (USA)

SWE Onsite

Question Details

Context The interview focuses on a Spreadsheet class initialized with specific dimensions ($M$ rows, $N$ columns). The class provides the following pre-built methods: * `set_cell(row, col, value

Full Details

Context The interview focuses on a Spreadsheet class initialized with specific dimensions ($M$ rows, $N$ columns). The class provides the following pre-built methods: * set_cell(row, col, value): Assigns a value or formula to a specific cell. * get_cell_value(row, col): A stubbed function that needs to be implemented. * print_sheet(): Iterates through the entire grid to print resolved values. * parse_formula(formula): A utility function that breaks down a formula string into a list of operand coordinates. * op(a, b): A method that performs an operation (such as addition) between two integers and increments a global execution counter. Part 1: Formula Evaluation The first task requires implementing get_cell_value(row, col). A cell's content is either a direct integer or a formula string in the format =(row1, col1)@(row2, col2)@(row3, col3).... * The implementation must distinguish between raw values and formulas. * If a formula is present, parse_formula must be used to retrieve dependent coordinates (e.g., [(row1, col1), (row2, col2), ...]). * The values from these coordinates must be resolved recursively and combined using the op function to return the final integer result. Part 2: Performance Optimization The second task addresses computational efficiency. Since every call to op increments a counter, the objective is to minimize these calls during redundant operations. For example, if print_sheet() is called twice consecutively without any data changes, the system should not re-calculate the formulas. The solution requires modifying the Spreadsheet class to implement a caching or memoization strategy. This ensures that the op function is only invoked when necessary (i.e., when dependencies have changed), keeping the execution counter as low as possible.

Free preview. Unlock all questions →

Topics

Strings Dynamic Programming