If you’re looking for solutions to this problem, check out 2 Light Bulbs and a 100 Story Building Solution. This article is a rant about the question itself.
I read this post What would Feynman do? which is a hilarious rendition of Feynman answering a common “lateral-thinking problem”.
Somewhere in the comments I read about the light bulb problem…
You have two light bulbs and 100 story building. You must determine the minimal floor such that if you drop the light bulb from that floor it breaks. Once you break a bulb, it can’t be reused. Question: What’s the smallest number of drops required in the WORST case to determine the minimal floor.
tl;dr The fewest drops required is 0.
My first reaction to this is to question the applicability of the method. After having dropped a light bulb, it incurs small, possibly unnoticeable stress fractures which weaken it’s integrity. Therefore if we drop the first light bulb from the first floor, then the second, then the third and it breaks on the 20th, one might assume that it takes dropping the light bulb from the 20th floor to break the light. However upon dropping the second light from the 20th floor, you find that it does not break, as it was not subjected to the stress of 19 previous drops.
However upon looking at the question a bit more closely, it doesn’t actually describe a method. The only requirement is that you determine the minimum height for which a light bulb will break. You are not required by the question to repeatedly drop the light bulb from the building. With this in mind, here’s my current solution.
Any method that takes into account the effect of cumulative stress will require n bulbs where n is equal to the maximum force required to break the bulb divided by the the step (increase in force of dropping the bulb from n+1 floors). For this reason we’ll disregard cumulative stress, even though it would be a huge factor in the real world.
Because we only have 2 bulbs we’ll have to reduce the scope of the tests a little bit. For the purposes of this exercise we will have to exclude environmental factors such as wind, precipitation and temperature. We must also assume a constant surface density and texture.
First we must determine the way that the light bulb will strike the surface. Since we only have 2 light bulbs, we obviously can’t test the point of failure of every square inch of each bulb. So the first thing we have to do is find the likely point of impact of our theoretical drop. To determine this we can use one of at least two simple methods. First we could repeatedly drop the bulb onto a padded surface and observe the orientation as it falls and strikes the ground. For a better simulation we could use a type of wind-tunnel that puts out enough force to keep the light bulb suspended in air so we can better observe the characteristics of it falling.
After determining the point on the bulb that will statistically strike the ground, we need to determine the required amount of force on that bulb to induce breakage. Before we begin striking our light bulb with 10,000 tons of force, we should determine the maximum amount of force that a light bulb can strike the ground with, taking into account the terminal velocity of said light bulb. Past this point, testing is unnecessary to determine that the light bulb is unbreakable by dropping.
We must also calculate the force difference between floors. Since the question asks what is the minimum floor off which we must drop the bulb, it doesn’t make sense to test strikes of a force which could only occur between floors.
To determine the breaking force, we will use a machine that can strike the bulb with a set force. At this point a well designed algorithm will allow us to reduce the number of strikes we must make on the bulb to determine the breaking force. The design of this algorithm is the obfuscated intent of the original question (2 Light Bulbs and a 100 Story Building Solution has answers to this, I won’t rehash them here).
Designing this algorithm will make our testing more efficient. However this is not required by the question at all. In fact we already know the answer to “the smallest number of drops required in the worst case to determine the minimal floor”. Assuming our math is correct, the smallest number of drops would be 0. We don’t actually have to drop the light bulb at all to answer this question, however we may still want to do it once to check our math and have a little fun (of course this would be after sectioning off an area and following appropriate safety precautions to avoid injuring pedestrians).
One reason to skip the optimization of the testing process would be to preserve the second bulb for a real-world test. However this is not strictly necessary, if we can prove the math we don’t really need to test it. If you’re doubting this, consider the fact that math is responsible for the entire space program and when we launch the next Mars rover, no one is questioning whether the spacecraft will be on target.
This method also addresses a limitation of the “correct” solution. What if the bulb doesn’t break after dropping it from the 100th floor? This method is sufficient to test the breaking strength of a bulb to at least the maximum force allowable by the terminal velocity of the bulb.
I have more points of contention with this question, but I’ve already spent too much time thinking about it and this post is long enough.
If you enjoyed this article, you will probably also like 3 Switches and 3 Light Fixtures, another rant about another common interview question.
- Some variations of the question use the phrase “unbreakable light bulbs”. In this case, upon breaking a light bulb, simply return it to the factory for a replacement (manufacturers are required to meet the claims of their advertising). The question states that “Once you break a light bulb it cannot be reused.” The “it” in that question refers to the broken light bulb, not the replacement that will be given to you by the manufacturer.