Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8274685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:47:44+00:00 2026-06-08T07:47:44+00:00

I was just reading The Two Egg Problem : The Two Egg Problem You

  • 0

I was just reading The Two Egg Problem:

The Two Egg Problem

You are given two eggs, and access to a 100-storey building. Both eggs are identical. The aim is to find out the highest floor from which an egg will not break when dropped out of a window from that floor. If an egg is dropped and does not break, it is undamaged and can be dropped again. However, once an egg is broken, that’s it for that egg.

If an egg breaks when dropped from floor n, then it would also have broken from any floor above that. If an egg survives a fall, then it will survive any fall shorter than that.

The question is: What strategy should you adopt to minimize the number egg drops it takes to find the solution?. (And what is the worst case for the number of drops it will take?)

I was following along until the "Look see I can do three" section. The author states that after the first egg breaks it degrades into the 2-egg problem and can be solved recursively.

That’s great, but wouldn’t we want to choose larger step-sizes when using 3 eggs instead of 2 (for the first egg)? From which floor do we throw the first egg?

With 1 egg, we have to start at floor 1.
With 2 eggs, we solve for n(n+1)/2=k and round up, where n is the starting floor, and k is the number of floors.
With 3… I’m having trouble coming up with a formula.


Thinking about this a bit more, with 2 eggs, the maximum number of drops is equal to the floor number that we drop our first egg from. For example, with 2 eggs and 100 floors, the solution is 14, which means we drop the first egg from floor 14, and if it breaks, we have to drop up to 13 more times, for floors 1-13.

With 3 eggs, the solution is 9 (as shown in the chart). But we wouldn’t want to throw the first egg at floor 9, we can throw it higher, because we don’t have to iterate by 1s in-between.

If we throw from floor 14 again, and it breaks, then we recurse. n(n+1)/2=k where k is now 13… but that gives us 4.815, if we ceil and that and add our previous drop we get 6, which is lower than the actual solution, so something here is wrong…


  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T07:47:45+00:00Added an answer on June 8, 2026 at 7:47 am

    If we throw from floor 14 again, and it breaks, then we recurse. n(n+1)/2=k where k is now 13… but that gives us 4.815, if we ceil and that and add our previous drop we get 6, which is lower than the actual solution, so something here is wrong…

    What if it doesn’t break? Then you have a three-egg problem with 86 floors, which takes maybe one drop less to solve than the 100-floor problem.

    Say you drop the first egg from the 50th floor. If it breaks, you have a two-egg problem with 49 floors, which takes up to 10 additional drops. So that would give you a worst-case of 11 drops (since if it doesn’t break, the 50-floor three-egg problem takes at most 7 additional drops).

    If you choose the 37th floor for the first drop, if it breaks, you have a 36-floor two-egg problem, needing up to 8 additional drops. If it doesn’t break, you have a 63-floor three-egg problem left. You want to solve that problem with at most 8 drops, so if the next drop breaks the egg, the remaining two-egg problem should be solvable in at most 7 drops, thus the highest floor you can choose for the second drop is 37 + 28 + 1 = 66, since 28 floors is the highest you can solve with at most 7 drops and two eggs. If the egg doesn’t break, you have a 34-floor three-egg problem with 7 drops left. The highest you can certainly solve with the remaining 6 drops if the egg breaks is 21 (6*7/2), so you can choose floor 66 + 21 + 1 = 88. If the egg doesn’t break, you have 12 floors left with 6 drops, which is already doable with only two eggs.

    Systematically, the highest number of floors you can certainly solve with d drops and e eggs is

              / 1, if d == 1
    F(e,d) = |  d, if e == 1
              \ F(e-1,d-1) + 1 + F(e,d-1), if e > 1 and d > 1
    

    If you have only one drop, you have no choice but to choose the lowest floor of which you do not yet know that the egg doesn’t break. If that breaks it, and you tried a higher floor, you don’t know the first floor to break the egg.

    If you have only one egg, you have to check every floor in order until the egg breaks or you run out of drops.

    Otherwise, if the first drop is from a floor higher than F(e-1,d-1) + 1, you possibly can’t find the first breaking floor if the egg breaks. If the first drop is from a lower floor, you can’t reach as high with d-1 drops if the egg doesn’t break, so the first drop should be from floor F(e-1,d-1) + 1. If it breaks, you can solve with the remaining e-1 eggs and d-1 drops by assumption. If not, you can solve for the next F(e,d-1) floors with the remaining drops and eggs.

    Conversely, to find how many drops you may need for f floors with e eggs, you have to find

    D(e,f) = min { d | F(e,d) >= f }
    

    You can find that by calculating the F(e,d) matrix, or you can use dynamic programming:

    If you choose floor s for the first drop, if the egg breaks, you need up to D(e-1,s-1) drops to determine the floor. If the egg doesn’t break, you need up to D(e,f-s) drops to determine the floor.
    So the worst case for choosing floor s for the first drop is

    WC(s,e,f) = 1 + max { D(e-1,s-1), D(e,f-s) }
    

    and the best of the worst case is

    D(e,f) = minimum { WC(s,e,f) | 1 <= s <= f }
    

    (where of course D(e,0) = 0).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just curious, is there any difference between the two ways below for file reading?
Was just reading about different algos disassemblers use to identify binary as assembly instructions.
i was just reading a great presentation about Quality Assurance for PHP Projects by
I'm just reading about OutputCache , and I see how you can apply VaryByParam
I was just reading abit about JMS and Apache ActiveMQ. And was wondering what
I was just reading about Magento , a free framework for easily creating an
I was just reading this line: The first thing the format() method does is
I was just reading a recent question on using conditionals in Linq and it
I was just reading this article and it mentions that some organization had an
I was just reading an update from a friend's project, mentioning the use of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.