Looking at other people's interview reports, most say they got one coding question and one system design question, but I got two coding questions — not sure if that's just because I was too slow and never got to the system design part...
The first question: there's a camera that processes camera data. The input is a vector and a threshold. Each element in the vector is a timestamp and a motion level. Find the time intervals in the sequence where the motion level is greater than the threshold.
For example, input:
vector = [[1, 0.4], [5, 0.2], [11, 0.9], [15, 0.9], [17, 0.8], [25, 0.5], [27, 0.8], [36, 0.9]];
threshold = 0.8;
output:
[[11, 17], [27, 36]];
Second question: building on the first one, now there's a bunch of cameras. The input is vector<vector<....>> and a threshold, and you need to find all the time intervals where every single camera's motion level is above the threshold. Basically, you use the code from question 1 to compute the above-threshold intervals for each camera, then compute the overlap across all the cameras' intervals. The follow-up was: what if there are a huge number of cameras, what's the bottleneck.
Because after I finished the first question I couldn't see the second question they had posted, I wasted some time on that. Then I refreshed the page once, and for the second question I reused the code I'd written for the first question — except the refresh meant the part of the code I'd edited before refreshing hadn't been saved, so the version of the question 1 code that carried over into question 2 actually had a bug in it. I spent a while debugging before I caught it, and by the time I fixed it there were basically only 10 minutes left...
Feels like I bombed it....
Discussion
Loading comments…