Location: San Francisco
First round phone interview.
https://leetcode.com/problems/game-of-life
The interviewer made the question easier by returning the next state of board as opposed to modifying the original input.
Input:
[
[0,1,0],
[0,0,1],
[1,1,1],
[0,0,0]
]
Output:
[
[0,0,0],
[1,0,1],
[0,1,1],
[0,1,0]
]
After solving the question in about 20 minutes, he then asked to write a few test cases, which I did.
Follow-up question:
What if the board is a million by a million?
He clearly expected some calculation here trying to figure out total size if the board was to be loaded in memory. I told him it was too big to fit into memory. Instead we can load each cell and its surrounding 8 cells at a time. He wasn’t satisfied with my answer.
A week later I was rejected. Overall the interviewer was kind and I expected rejection because I know I didnt answer his followup question well.