Comment

Comment by mratzloff

It's a binary search in infinite space. His solution expands the problem area until the number is in the space and then shrinks the problem area until it finds the number. A better solution is to pick an arbitrarily large number and only expand if you have to--otherwise you're shrinking from the very beginning.

That's how I would have answered the question, anyway. But yes, I've dealt with interviewers like this--typically it's because they don't understand the subject matter well enough to evaluate or accept an answer they didn't prepare for.

parent mratzloff 14 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton