I think the team was TV.
It was supposed to be a hiring manager round with one interviewer, but a different interviewer joined instead. He said we would be writing code, but then he suddenly started a deep dive into my resume and we talked for 20 minutes.
Then he moved on to the problem, which was either whatever "Jiujiusi" is or plant poisoning. 0 is healthy and 1 is poisoned. If a healthy cell has K or more poisoned cells among its 8 neighbors, that healthy cell becomes poisoned too. The question was how many days it takes to stabilize, meaning no new plants get poisoned.
I used a brute-force approach, simulating the whole grid every day, with complexity m * n * p. I finished writing it.
The interviewer said to optimize it, and this is where I got stuck. He gave me a hint to use BFS, which can bring it down to M * N. I explained it out loud and did not write it. Then he said the data could be extremely large, and I described the sparse matrix approach out loud.
Two days later, I got rejected.
Discussion
Loading comments…