@@ -108,88 +108,8 @@ Note:
108
108
109
109
## 代码
110
110
111
- ``` js
112
111
113
- /*
114
- * @lc app=leetcode id=887 lang=javascript
115
- *
116
- * [887] Super Egg Drop
117
- *
118
- * https://leetcode.com/problems/super-egg-drop/description/
119
- *
120
- * algorithms
121
- * Hard (24.64%)
122
- * Total Accepted: 6.2K
123
- * Total Submissions: 24.9K
124
- * Testcase Example: '1\n2'
125
- *
126
- * You are given K eggs, and you have access to a building with N floors from 1
127
- * to N.
128
- *
129
- * Each egg is identical in function, and if an egg breaks, you cannot drop it
130
- * again.
131
- *
132
- * You know that there exists a floor F with 0 <= F <= N such that any egg
133
- * dropped at a floor higher than F will break, and any egg dropped at or below
134
- * floor F will not break.
135
- *
136
- * Each move, you may take an egg (if you have an unbroken one) and drop it
137
- * from any floor X (with 1 <= X <= N).
138
- *
139
- * Your goal is to know with certainty what the value of F is.
140
- *
141
- * What is the minimum number of moves that you need to know with certainty
142
- * what F is, regardless of the initial value of F?
143
- *
144
- *
145
- *
146
- *
147
- *
148
- *
149
- *
150
- * Example 1:
151
- *
152
- *
153
- * Input: K = 1, N = 2
154
- * Output: 2
155
- * Explanation:
156
- * Drop the egg from floor 1. If it breaks, we know with certainty that F = 0.
157
- * Otherwise, drop the egg from floor 2. If it breaks, we know with certainty
158
- * that F = 1.
159
- * If it didn't break, then we know with certainty F = 2.
160
- * Hence, we needed 2 moves in the worst case to know what F is with
161
- * certainty.
162
- *
163
- *
164
- *
165
- * Example 2:
166
- *
167
- *
168
- * Input: K = 2, N = 6
169
- * Output: 3
170
- *
171
- *
172
- *
173
- * Example 3:
174
- *
175
- *
176
- * Input: K = 3, N = 14
177
- * Output: 4
178
- *
179
- *
180
- *
181
- *
182
- * Note:
183
- *
184
- *
185
- * 1 <= K <= 100
186
- * 1 <= N <= 10000
187
- *
188
- *
189
- *
190
- *
191
- *
192
- */
112
+ ``` js
193
113
/**
194
114
* @param {number} K
195
115
* @param {number} N
@@ -205,7 +125,6 @@ var superEggDrop = function(K, N) {
205
125
for (let k = 1 ; k <= K ; ++ k)
206
126
dp[m][k] = dp[m - 1 ][k - 1 ] + 1 + dp[m - 1 ][k];
207
127
}
208
- console .log (dp);
209
128
return m;
210
129
};
211
130
```
0 commit comments