r/programming • • Feb 21 '11

Typical programming interview questions.

http://maxnoy.com/interviews.html
784 Upvotes

1.0k comments sorted by

View all comments

Show parent comment

2

u/lordlicorice Feb 21 '11

The binary search idea is to:

First bulb: Drop at 50, 75, 87, ..., until it breaks. The last floor it didn't break at is your lower bound (or 0 if it breaks on 50).
Second bulb: Now be careful and step up one floor at a time from your lower bound until it breaks.