News for hackers. Stuff that matters.
Re:Ask HN: What is your favourite technical interview question? by MountainDrew on Thursday October 28, 2010 @04:16PM (#1844750)
Because you only have 2 eggs I don't think you can use a binary search algorithm (assuming I understood the question correctly). I think you'd have to start at floor 2, if that passed then jump to floor 4, etc. until you have an egg break (lets call this floor n). Then, you go to the floor below the one that broke the egg to see if an egg survives that drop. You'll then know, using only 2 eggs the highest floor you could drop from without breaking an egg (either n, n-1, or n-2).
Re:Ask HN: What is your favourite technical interview question? by spokey on Thursday October 28, 2010 @04:31PM (#1844821)
Spot on. I missed the 2 part, which makes this question much more interesting. By the way, I think I do could it in one drop; drop one from floor 1. If it breaks the answer is 0, else 1 because I don't think many eggs could survive a two story drop.
Re:Ask HN: What is your favourite technical interview question? by djb_hackernews on Thursday October 28, 2010 @05:13PM (#1844994)
close. Suppose the answer is 99? How many drops would it take to figure that out? Could you do it in less?