[USA] Sigma Computing Second Round
Summary
I had my second-round interview for Sigma Computing in the USA. Although I was ultimately rejected, I found the process fair and the questions challenging and engaging, mimicking a real work scenario.
Full Experience
I had my second-round interview for Sigma Computing, which I found to be a bit harder than the first round but thematically linked. The interviewer cared a lot about communication, and the recruiter had emphasized this earlier. Despite receiving a rejection, I genuinely enjoyed the candidate experience and thought it was a very fair process. It wasn't like some companies that make you do a 10-hour take-home assignment only to be ghosted. The interview mimicked a real working session where I needed to modify and incorporate existing code to solve problems, rather than just being a 'LeetCode-brained' exercise.
Interview Questions (2)
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 intaandb. Assumeopis a magic function and it could be anything, but right now, just addition
In 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.
Part 1: Implement get_cell_value(row, col)
get_cell_value(row, col) has a not defined implementation. Cell values are either 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 I needed to implement get_cell_value(row, col) and see working run.
Part 2: Performance Improvement
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? I could modify anything in the Spreadsheet class.
This part was the meat of the interview and required some open-ended thinking, so it's a creative problem. I needed to get the counter value as low as possible.