answersLogoWhite

0

Suppose that there is a building with 100 floors. You are given 2 identical eggs. The most interesting property of the eggs is that every egg has it’s own “threshold” floor. Let’s call that floor N. What this means is that the egg will not break when dropped from any floor below floor N, but the egg will definitely break from any floor above floor N, including floor N itself.

For example, if the property of the eggs is that N equals 15, those eggs will always break on any floor higher than or equal to the 15th floor, but those eggs will never break on any floor below floor 15. The same holds true for the other egg since they are identical.

These are very strong eggs, because they can be dropped multiple times without breaking as long as they are dropped from floors below their “threshold” floor, floor N. But once an egg is dropped from a floor above it’s threshold floor

Here is the puzzle: What strategy should be taken in order to minimize the number of egg drops used to find floor N (the threshold floor) for the egg? Also, what is the minimum number of drops for the worst case using this strategy?

Remember that you are given 2 identical eggs which both have the same exact threshold floor.

Your first instinct (especially if you are a programmer) may be to solve this problem using the binary search method. So, you think that maybe by dividing the “result set” in half each time you will be able to solve the problem and find the threshold floor for the eggs. In this case the “result set” is the floors in the building, so you start at floor 50 since that is half of 100.

Let’s say we do start at the 50th floor, then what should we do if the egg breaks? This means that the answer is somewhere between the first and 50th floor. And we would be left with only 1 more egg since we started with 2 eggs. Now if we are following the binary search method, it seems that the next step would be to try dropping the remaining egg from the 25th floor. But what if it breaks at the 25th floor? Then we really don’t have an answer to the problem since we have not found the threshold floor for the eggs. Even if it doesn’t break and we decide to go to the next floor (which would be half of 25 or 12.5, which is approximately 13), then if it breaks at the 13th floor then we would still not have an answer to the problem.

Clearly the binary search method does not work for us here, because we only have 2 eggs. The binary search method would be good in a scenario where we have an infinite number of eggs, but we now have to change our strategy and find a better solution.

A new solution

Since we have to find the answer with 2 eggs then why not do something like this: we start by dropping one of the eggs on the 10th floor: if it doesn’t break then we continue on to the 20th floor, then 30th, 40th… up to 100 in intervals of 10 until the first egg actually breaks. If the egg breaks on the 10th floor then we know that the threshold floor must be either the 10th floor or one of the floors below it – the egg will definitely break on any floor above the 10th floor, so we can eliminate all of the floors above the 10th.

If the egg breaks on the 10th floor…

So, the answer must be between floors 1 through 10. We can take the 2nd egg and drop it from the first floor. If it does not break on the first floor, but it does break on the 2nd floor, then we know that the 2nd floor is the “threshold” floor. And if it doesn’t break on any of the floors between 2-8, then we just continue up until the 9th floor, and if it does not break on the 9th floor then we know that the 11th floor is our threshold floor. This will take a maximum of 10 drops to figure out the threshold floor in this instance.

What about the worst case solution? Well, the worst case using this method occurs when the threshold floor is the 100th floor. This means that we use 10 drops to get to the 100th floor, because we start from the 10th floor and go up in intervals of 10 up to the 100th floor, and the first egg will break on the 100th floor. And then we use another 9 drops with the 2nd egg because we have to test floors 90-99 to see if the threshold floor is somewhere in that range. This gives us a total of 19 drops, which is the absolute worst case scenario using this method.

2 Eggs 100 Floors Puzzle Solution

We want to minimize the number of drops for the worst case, while still using an approach that works well for other scenarios. So, how can we do this? Well, we should rephrase that question and ask ourselves what is really holding us back here? The main reason why it takes such a large number of drops in the worst case with our approach above (19 drops) is because in order to test out the higher floors of the building we have to start at the lower floors of the building, and at that point we have already used a large number of drops just to get to that point.

User Avatar

Aira Shakir

Lvl 7
4y ago

What else can I help you with?

Related Questions

What was the fewest amount of walks for Yogi Berra in a year?

The fewest amount of walks for Yogi Berra with at least 100 games played in a season was 22. That was in 1949 and Yogi played 116 games. In 1947, Yogi played in 83 games and walked 13 times.


The femur can withstand times the body weight without breaking?

10-15


The mechanical advantage of a machine is the number of times it?

The mechanical advantage of a machine is the number of times it can perform the same task without breaking down.


How do you get a shiny starter on leafgreen Pokemon without hack?

You can by soft resetting a numerous amount of times.


When was End Times - Breaking Bad - created?

End Times - Breaking Bad - was created on 2011-10-02.


Which option for drinking water used the fewest resources from the environment if it is used many times?

Natural recycled water


Do Edward and Bella ever do it?

They do it in Breaking Dawn, PART 1 and as far as i know they do it 3 times when Bella is a human. On there honeymoon!!!!! They do it more with Bella is turned into a vampire in Breaking Dawn, PART 3 as a human in breaking dawn, 3 times- in part 3 of breaking dawn, like a million of times


How many feet of baseboard should be ordered with 10 percent waste?

1.1 times the amount required.1.1 times the amount required.1.1 times the amount required.1.1 times the amount required.


What does the quotient mean when you divide 22.4 by 0.5?

It is the amount of times 0.5 goes into 22.4, without the remainder. So the quotient is 44.


How do you lvl fast on ff a2 tactics?

Do the Clan Trial 'Teamwork - Aptitude' a few times to get the law privilege Bonus EXP 3, then do lots of quests (as high rank as you can without it being too difficult) without breaking the law.


How can you stop talking for a whole day?

It should not be hard to do if there is a will to do it. Some respectable people in history went without speaking for extensive amount of times.


How do NFL teams rank in number times the QB has been sacked?

The team with the fewest sacks in #1 the team w/ the most is the worst (#32)