Skip to content

2 eggs and 100 floors puzzle

  • by

The 2 eggs and 100 floors puzzle is a classic problem in mathematics and computer science. The problem goes as follows:

You are given 2 identical eggs and a 100-story building. Your task is to determine the highest floor from which an egg can be dropped without breaking. You can drop the eggs from any floor and they will either break or not break. However, once an egg breaks, it cannot be used again.

2 eggs and 100 floors puzzle

2 eggs and 100 floors puzzle Solution

To determine the floor number ‘N’ where an egg breaks, follow these steps:

  1. Begin by throwing the egg from the 10th floor.
    • If the egg breaks, ‘N’ is between 1-9.
    • If the egg does not break, move to step 2.
  2. Throw the egg from the 20th floor.
    • If the egg breaks, ‘N’ is between 11-19.
    • If the egg does not break, move to step 3.
  3. Continue this process by throwing the egg from every 10th floor until it breaks or until you reach the 100th floor.
    • Once the egg breaks, you can determine ‘N’ by using the previous two floors where the egg did not break.

In the worst-case scenario, you will need to perform 19 drops: 10 drops on each 10th floor and 9 drops in between floors 91-99.

It is a popular problem in job interviews and is used to test critical thinking and problem-solving skills.

Leave a Reply

Your email address will not be published. Required fields are marked *