last day (15 days later) » 

20:29
0
Q: Interview problem - two light bulbs and a 100-story building

xameeramirI was looking at this problem. You have two light bulbs and a 100-story building. You want to find the floor at which the bulbs will break when dropped. Find the floor using the least number of drops. What is the right way to answer this?

The right way to answer that as an interview question is to immediately terminate the interview. Why would you want to work with people who would pose such a stupid question.
I'm sorry @HLGEM - there is nothing stupid here. The most important thing is the way to answer this.
No, this question is irrelevant to whether you can do the job. Any company asking such questions is a company that you don't want to work for even if they have big name.
It doesn't require you to find the smallest floor number so the answer is the top floor. No light bulbs were hurt while solving the puzzle. Also, going by personal experience with light bulbs, the lobby would also be acceptable.
@HLGEM The ability to come up with an optimal algorithm is a stupid question?
20:29
@Frisbee It's the ability to argue semantics as I've done in my solution. The optimal algorithm would be heuristic, but the supply of light bulbs is not enough to complete the experiment. It's a stupid question.
If you search the Internet you will find the answer. It is an interesting problem and shows ability for analytic though and algorithms. It is like 13 drops.
I guarantee I would solve this in less than 13 drops unless the light bulbs are industrial strength and reinforced in some bizarre way. That is why I hate questions like this. The "correct" answer probably assumes you have NO IDEA WHAT TO EXPECT and have to base your choices on any floor potentially being the right one but... I have a pretty good idea what to expect and could use that pretty good idea to streamline the process.
@hlgem 100 stories 2 bulbs is enough information.
@AndrewWhatever Then solve it. Yes any floor can be the right one. You have two bulbs to figure it out.
@AndrewWhatever: Oh, and be sure to show your work and identify which proof method you're using.
@rath If you think it is about semantics and the problem statement is incomplete then you don't get the job.
20:29
Of course any floor cannot be the right one, only one floor can be the right one or the question is meaningless. What you really mean is that I don't have enough information to eliminate any floors. And I'm saying that if you give me two "average" light bulbs and let me look at them for 10 seconds, I will safely eliminate floors and give you an accurate answer in less than 13 drops. This isn't about proofs this is something I will do for you in real life. If you don't believe me ship me the light bulbs and find me a building that will let me do this test.
It's not about semantics at all though. It is about real life judgment calls that can eliminate needless steps, which is a VERY IMPORTANT trait in many jobs.
I'm voting to close this question as off-topic because this question is about a brain teaser; not about navigating the workplace.
@AndrewWhatever If you think is is about inspecting and actually dropping the bulb then you don't get the job.
@AndrewWhatever: Sorry, but this is an algorithm problem and is absolutely about proofs. Thanks for applying. Our offices will be in touch with you if we need anything further.
I know what it is. And I'm sure I could solve it however they wanted. I just hate questions like this because what they want is not what they actually asked.
20:29
@AndrewWhatever So now they don't really want an answer to the stated question. Me, I answer the question as stated.
No, I'm saying their stated question is too specific to be asking for a generalized algorithm, even though that is obviously the answer they want. I get that they don't just want to give you a math problem to solve and want to see if you can think creatively, but... if thinking creatively means ignoring how you would actually do this in the real world and just paring it down to a math problem anyway, that's silly.
@AndrewWhatever What part of they want the minimum but of drops is not clear? In the real world that is solved with math. And you are wrong that it can be done in less than 13.
@Frisbee I went for a shower after responding to your comment and realized that it's actually algorithmic design, not those stupid brain-teasers everyone was obsessed with a few years ago. I came up with a non-smartass solution, and I stand corrected.
No in the real world this is an impossible question to solve, because no two light bulbs are exactly the same, no two drops will result in the exact same impact angle, the stress from "successful" drops would still impact the structural integrity of a lightbulb for subsequent tests, etc. I posit that I could give you a million light bulbs to play with and you could never solve this with a specific floor number that would consistently work for every light bulb following the rules of the test. But I digress, that's not my exact point.
My point is that if you're introducing these "real world" elements (like using actual light bulbs) into your brainteaser not only does it become impossible to solve without ignoring the elements and reverting it back to a generalized math problem, but that any real world application would naturally introduce a lot more variables that would make your generic solutions inapplicable to most business situations.
@AndrewWhatever If you don't get assume two identical bulbs and identical drops is implied then you don't get the job. The question is not about light bulbs. You think a plane leave traveling at 200 mph two hours after a car traveling 60mph when will they cross is about trains and cars? It is called abstraction - and it would be very clear to the interviewer you don't get abstraction.
20:29
Ug. Obviously I get that. I'm saying to me it's dumb. If you're making up light bulbs that don't even exist in the real world and a bunch of other rules that don't exist in the real world you're clearly not looking for my answer to what I would actually do if presented a real world scenario so... just give me an X and a Y and let me solve your abstract problem without all of this made up nonsense instead.
In my experience, the first floor ...
I would answer that they probably expect me to tell them that I'll use binary search to determine the minimum height, but since I know from personal experience that bulbs break quite easily, I'll drop one from the first floor and then if it doesn't break, I'll drop the next one from the 2nd floor. I'll also tell them that this is not a good question to ask because the real world information that's provided is not enough and any abstract solution will have to disregard those real world elements.
Actually you know what would really make me want to hire someone? "I got the answer A which I know is what you want me to answer... however, I am reasonably certain that I can safely eliminate X floors from the top, which if I am correct in my assumption would give us A-B as the answer, but if I am wrong it will end up at A+C. Furthermore I can run the numbers on eliminating other amounts of floors from the top as well if you want me to, and try to calculate risk versus reward for each. Which of these options best fits your business goals?"

last day (15 days later) »