HR reached out to me on LinkedIn, and we scheduled a round right away. Not a tag question.
Say you have a job scheduler that processes events. The input is a timeout value and a stream of events, and you need to figure out which events time out. Events come in three modes: start, end, and ping. A ping updates an event's status, and if the time between an event's last update and the current time exceeds the timeout, that event has timed out — you need to record it and return it.
Not a hard problem — I used an LRU to solve it. But everything had to be worked out with the interviewer along the way: they basically just gave me one or two examples and stated the problem out loud, and I had to define the input and output completely on my own. Once I had those defined, I also had to explain and discuss the pros and cons of this approach in a production setting. While I was actually writing the code, they kept asking me about all kinds of edge cases the whole time — I probably spent 20 minutes just on discussion and figuring out exactly what was wanted, and by the time I finished writing I didn't even have time left to run the tests. They also asked a few follow-ups, like what optimization options exist, and what kinds of input you might realistically see in production and how you'd handle each of those.
Discussion
Loading comments…