Add new comment

Permalink
Comment

With the following method it take max 14 trys (to reach every floor up to 100).

1. Test from floor 14.
If it fails, test with second egg the floors from 1 to 13 until the second egg breaks.
It will take max 13 further trys to test from all floors below 14.
==> 1 test (first egg) + max 13 tests (second egg) <= 14 tests.

2. If the first test is positive, test from floor 27 (14+13).
If it fails, test with second egg the floors from 15 to 26 until the second egg breaks.
It will take max 12 further trys to test all floors betwee 15 to 26.
==> 2 tests (first egg) + max 12 tests (second egg) <= 14 tests.

3. If the second test is positive, test from floor 39 (14+13+12).
If it fails, test with the second egg in the same way as in 1. and 2. for floors 28 to 38.
==> 3 tests (first egg) + max 11 tests (second egg) <= 14 tests.

4. If the third test is positive, test from floor 50.
If it fails, test with the second egg from the floors 40 to 49.
==> 4 tests (first egg) + max 10 tests (second egg) <= 14 tests.

5. If the fourth test is positive, test from floor 60.
6. If the fifth test is positive, test from floor 69.
7. If the sixth test is positive, test from floor 77.
8. If the seventh test is positive, test from floor 84.
9. If the eighth test is positive, test from floor 90.
10. If the ninth test is positive, test from floor 95.
11. If the tenth test is positive, test from floor 99.
If it fails, test with the second egg from the floors 96 to 98.
==> 11 tests (first egg) + max 3 tests (second egg) <= 14 tests.

12. If the elevenths test is positive, test finally from floor 100.
==> 12 tests (first egg) + no test (second egg) = 12 tests.

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.