2 ms·
Well, I've been in this scenario before, and have resorted to that. I was this guy [1]. (Interview question in link, I had written a solution.) The interviewe
by SilasX 9y ago
Well, I've been in this scenario before, and have resorted to that. I was this guy [1]. (Interview question in link, I had written a solution.)
The interviewer stubbornly insisted that the run time was n^2 because it had an inner loop. (Never mind that the inner wasn't looping over pairs with the bigger loop, but just the bits within that element.)
I went through a number of heuristics to convince him otherwise: what if you doubled the list, how would that analytically affect the run time? What if the elements were bigger? (as you can find from the reddit thread)
Disturbingly, I asked him what he would need to see to convince him that the code I wrote was O(n), and he said, "no inner loop", which reveals a profound misunderstanding of both the issue at hand, and how to resolve disagreement. At that point, I resorted to saying, well, let's run the code with increasing input size and see how it scales (which would give valuable information about its actual scaling behavior).
Then he refused, left the room, and told the director to veto me from the rest of that day's interviews.
[1] https://news.ycombinator.com/item?id=6070001 https://news.ycombinator.com/item?id=6070001
- wyldfire 9y ago> Then he refused, left the room, and told the director to veto me from the rest of that day's interviews. "Bullet dodged" -- he did you a huge favor.