You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are given K eggs, and you have access to a building with N floors from 1 to N.
8
+
You are given K eggs, and you have access to a building with N floors from 1 to N.
9
9
10
10
Each egg is identical in function, and if an egg breaks, you cannot drop it again.
11
11
12
12
You know that there exists a floor F with 0 <= F <= N such that any egg dropped at a floor higher than F will break, and any egg dropped at or below floor F will not break.
13
13
14
-
Each move, you may take an egg (if you have an unbroken one) and drop it from any floor X (with 1 <= X <= N).
14
+
Each move, you may take an egg (if you have an unbroken one) and drop it from any floor X (with 1 <= X <= N).
15
15
16
16
Your goal is to know with certainty what the value of F is.
17
17
18
18
What is the minimum number of moves that you need to know with certainty what F is, regardless of the initial value of F?
19
19
20
-
20
+
21
21
22
22
Example 1:
23
23
24
24
Input: K = 1, N = 2
25
25
Output: 2
26
-
Explanation:
26
+
Explanation:
27
27
Drop the egg from floor 1. If it breaks, we know with certainty that F = 0.
28
28
Otherwise, drop the egg from floor 2. If it breaks, we know with certainty that F = 1.
29
29
If it didn't break, then we know with certainty F = 2.
0 commit comments