F
[
d,e
]
= The highest floor that can be tested with
d
drops and
e
eggs.
D
[
f,e
]
= The minimum number of drops needed to test
f
floors with
e
eggs.
E
[
f,d
]
= The minimum number of eggs needed to test
f
floors in
d
drops.
d
= Drop counter
e
= Egg counter.
N
f
= A given number of floors (= 100 in the question)
N
e
= A given number of eggs (= 2 in the question)
N
d
= A given number of drops
4 Particular solution for 100 floors and two eggs
4.1 Initial solution
If there is only one egg, the solution is quite obvious. There is nothing betterthan trying at every floor 1, 2, 3, ...,
N
f
, requiring
N
f
drops. When there aretwo eggs, and we finally find the minimum number of drops
N
d
needed for
N
f
floors, we should span them in such a way that every sub-case should take
N
d
drops in the worst case.So, the initial drop should be from floor
N
d
, so that if it breaks, the right floorcan be found by trying floors 1
−
N
d
.Now we have
N
d
−
1 drops left, so the next drop should be at
N
d
+
N
d
−
1 =2
.N
d
−
1. This can be continued like this:Let
f
[
d,e,N
d
]
denote the floor that need to be tried at the
d
th
drop when thereare
e
eggs and we know the correct number of drops
N
d
.
f
[1
,
2
,N
d
]
=
N
d
f
[2
,
2
,N
d
]
=
F
1
,
2
+
N
d
−
1 =
N
d
+
N
d
−
1 = 2
.N
d
−
1
f
[3
,
2
,N
d
]
=
F
2
,
2
+
N
d
−
2 = 3
.N
d
−
3
f
[4
,
2
,N
d
]
=
F
3
,
2
+
N
d
−
3 = 4
.N
d
−
6...
F
[
d,
2
,N
d
]
=
d.N
d
−
d
(
d
−
1)2(1)Now, to solve the particular problem, we need to find
d
such that
F
[
d,
2
,d
]
≥
100.So,
d
2
−
d
(
d
−
1)2
≥
1002
Leave a Comment