MEDIUMasked at 2 companies

Egg Drop With 2 Eggs and N Floors

A medium-tier problem at 74% community acceptance, tagged with Math, Dynamic Programming. Reported in interviews at Disney and 1 others.

Founder's read

You're in a live OA and hit this problem cold: two eggs, N floors, find the minimum number of drops to determine the critical floor. It's deceptively simple until you realize your first instinct (binary search) doesn't work for eggs. Disney and Citadel both ask this. The trick isn't DP brute-force, it's recognizing the math pattern that lets you solve it in linear time with no recursion. If you blank on it during screen share, StealthCoder surfaces the solution invisibly in seconds.

Companies asking
2
Difficulty
MEDIUM
Acceptance
74%

Companies that ask "Egg Drop With 2 Eggs and N Floors"

If this hits your live OA

Egg Drop With 2 Eggs and N Floors is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop.

Get StealthCoder
What this means

Most candidates jump to dynamic programming and build a 2D table. That works but misses the insight. With exactly two eggs, the optimal strategy isn't to halve the search space. Instead, you drop the first egg at intervals and shrink those intervals as you climb. The real answer: if you drop the first egg at floors 1, 3, 6, 10, 15 and so on (triangular numbers), the worst case is k drops for n floors when k(k+1)/2 >= n. Solve for k and you're done. No DP table needed. The acceptance rate sits at 74%, meaning a lot of candidates solve it, but many waste time on overkill approaches. StealthCoder hedges the ones who didn't see the math pattern beforehand.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Egg Drop With 2 Eggs and N Floors recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Egg Drop With 2 Eggs and N Floors interview FAQ

Is this really a 'medium' problem or is it harder?+

The difficulty tag is accurate, but it's a medium that punishes you for not seeing the pattern. If you go full DP, you'll solve it but inefficiently. The candidates who crack it fast recognize the triangular number insight, which isn't obvious. That's why acceptance hovers at 74%.

Why doesn't binary search work with two eggs?+

Binary search assumes you can always halve the remaining possibilities. With two eggs, if your first egg breaks, you're stuck linear-searching with one egg. You can't afford to waste a break in the middle. You need an asymmetric strategy that minimizes the worst case when the first egg drops.

Do I need to code the full DP solution or can I just derive the formula?+

Most interviewers accept the formula. If you derive it correctly (worst case is k drops, so k(k+1)/2 >= n, solve for k), you've shown the math reasoning. Some may ask you to code a validator that confirms your answer matches brute-force DP, which takes two minutes.

Have Disney and Citadel asked this recently?+

Both companies have reported asking it. It's a deliberate choice for screening candidates who think beyond standard DP templates. They're testing pattern recognition and mathematical insight, not just code-and-recurse ability.

What's the most common mistake on this problem?+

Writing a 2D DP table where you iterate all possible first-drop positions and all outcomes. It works but takes longer to code and reason through under time pressure. Worse, you might not realize the formula exists, so you memorize a DP solution and forget it when framed differently.

Want the actual problem statement? View "Egg Drop With 2 Eggs and N Floors" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.