Free 5-Day Mini-Course: [ Ссылка ]
Try Our Full Platform: [ Ссылка ]
📹 Intuitive Video Explanations
🏃 Run Code As You Learn
💾 Save Progress
❓New Unseen Questions
🔎 Get All Solutions
Question: You are given n eggs and specified a number of k floors. Write an algorithm to find the minimum number of drops is required to know the floor from which if the egg is dropped, it will break.
Note: There are more optimal solutions than this approach, but in a 45-minute interview they seem to me unreasonable to get. So I covered what one could reasonably deduce given they have never seen this question.
Complexities
Time: O( totalEggs * totalFloors^2 )
We will have totalEggs * totalFloors subproblems and spend O(totalFloors) time computing each subproblem.
Space: O( totalEggs * totalFloors )
We can upper bound to the number of subproblems which will be totalEggs * totalFloors subproblems (whether you include the base cases or not in the memoization table)
++++++++++++++++++++++++++++++++++++++++++++++++++
HackerRank: [ Ссылка ]
Tuschar Roy: [ Ссылка ]
GeeksForGeeks: [ Ссылка ]
Jarvis Johnson: [ Ссылка ]
Success In Tech: [ Ссылка ]
Ещё видео!