4 ms·
I interview tons of candidates at a FAANG company, and I can tell you for sure binary search is way too hard to get right on a whiteboard. Even in a proper codi
by nardi 6y ago
I interview tons of candidates at a FAANG company, and I can tell you for sure binary search is way too hard to get right on a whiteboard. Even in a proper coding environment I wouldn't ask it. There are lots of better questions with fewer sharp edges.
- deleted 6y ago[deleted]
- Der_Einzige 6y agoWhat else is hard besides converting (high + low) / 2 To Low + (high - low) / 2 What else about this problem is a "sharp edge"?
- nardi 6y agoI may have been a little too harsh. Binary search is close to being a good interview question, especially since the algorithm does, rarely, come up in real code. But I prefer questions that are more like what people will be doing in their day-to-day job, and binary search is just a little too fiddly.
- CamperBob2 6y agoMe: "Show me a binary search in C on the whiteboard." Candidate: bsearch(key, base, num, size, compare_fn); Me: "Your offer should arrive within one to two weeks. Need any help with relocation expenses?"
- nardi 6y ago100% this. Maybe not everyone knows the specific function you’re looking for, but for the ones that know standard library APIs really well, that’s your hire.
- User23 6y agoI wouldn’t say so. In theory you’d expect a FAANG engineer to be able to construct a correctly terminating loop by reasoning about the loop invariant, but in practice every single candidate gets lost in guesswork and messing up the edge cases and termination condition.