by unimpressive · 9y ago · 0 comments
"Iterate through the list and check to see if it already exists."
What happens if you reply:
"You have a million items. You write the quick solution and find it goes very slowly. What would you do to speed it up?"
I suspect the rate of people who can give a decent optimization answer goes up massively if you make it clear that you're looking for something like the optimal answer, not the conceptually simple one. It doesn't matter if I use linear search if my N is some trivial number like 17, which is what I suspect most candidates have in mind.
(Of course, there's a certain perspective from which anybody who needs this kind of coaxing is a no-hire anyway.)