Skip to content

Commit 21b4ce2

Browse files
committed
Add Solution.py for 0887.Super Egg Drop
1 parent 19b5614 commit 21b4ce2

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Solution:
2+
def superEggDrop(self, K: int, N: int) -> int:
3+
dp = [1] * (K)
4+
while dp[K - 1] < N:
5+
for i in range(K - 1, 0, -1):
6+
dp[i] = dp[i] + dp[i - 1] + 1
7+
dp[0] = dp[0] + 1
8+
return dp[0]

β€Žsolution/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,8 @@
943943
β”‚Β Β  └── Solution.py
944944
β”œβ”€β”€ 0887.Super Egg Drop
945945
β”‚Β Β  β”œβ”€β”€ README.md
946-
β”‚Β Β  └── Solution.java
946+
β”‚Β Β  β”œβ”€β”€ Solution.java
947+
β”‚Β Β  └── Solution.py
947948
β”œβ”€β”€ 0889.Construct Binary Tree from Preorder and Postorder Traversal
948949
β”‚Β Β  β”œβ”€β”€ README.md
949950
β”‚Β Β  └── Solution.py

0 commit comments

Comments
Β (0)