First round: Here
Had second round for Sigma Computing, which is a tad bit harder than the first round, but thematically linked.
You are given a pre-built spreadsheet class with these functions:
set_cell(row, col, value)get_cell_value(row, col) --> stubbed out functionprint_sheet() --> go through all rows and cols and print the valueparse_formula(formula) --> util function for your useop(a, b): perform addition between two int a and b. Assume op is a magic function and it could be anything, but right now, just additionIn this case, the spreadsheet is M rows, N cols and you can instantiate like sheet = Spreadsheet(5, 3) meaning 5 rows, 3 columns. In the previous question, we assumed infinite rows for the spreadsheet but finite columns
get_cell_value(row, col)get_cell_value(row, col) has a not defined implementation. Cell values are eiher an integer or a formula in format of =(row1, col1)@(row2, col2)@(row3, col3)....
parse_formula in the above would give operands like [(row1, col1), (row2, col2), ....]
Test case was provided but you need to implement get_cell_value(row, col) and see working run
In the spreadsheet class, every time you call op(a, b) function, you will increment a counter. Suppose you call print_sheet() two times in a row and nothing changes in the sheet, could we reduce the number of calls to op function? You can modify anything in the Spreadsheet class
This part is the meat of the interview and requires some open ended thinking, so it's a creative problem. You need to get the counter value as low as possible
Even though I got rejected, I enjoyed the candidate experience and very fair process. Nothing too insane like some companies that make you do 10 hr takehome for you to get ghosted