Coding interview questionMedium
Meta

Minimum Worst-Case Drops with Two Bulbs

Given two identical bulbs and a building with F floors, return the minimum number of drops needed in the worst case to guarantee identifying the critical threshold floor.

1. Problem Statement

You have two identical bulbs and a building with F floors (numbered 1 to F). There is some unknown critical threshold T (1 ≤ T ≤ F + 1) such that: - A bulb survives if dropped from any floor ≤ T - 1. - A bulb breaks if dropped from any floor ≥ T. - T = F + 1 means the bulb survives from every floor in the building. A broken bulb cannot be reused. Return the minimum number of drops needed in the worst case to guarantee identifying T. Start with any clarifying questions, then explain your approach.

2. Live Coding Format

Work in the provided coding workspace while explaining your decisions to the live interviewer. Validation may use inline tests, examples, comments, or a verbal walkthrough.

3. Key Focus Areas

  • 1
    Problem clarification and modelling
  • 2
    Strategy derivation and optimality
  • 3
    Implementation correctness
  • 4
    Worst-case analysis and tracing
  • 5
    Edge cases and follow-up

4. What Strong Candidates Should Demonstrate

  • Clarify the breaking model, the range of T and the worst-case goal before choosing a strategy.
  • Derive a drop strategy that minimises the worst case and argue why no strategy can do better.
  • Implement the drop-count computation for the full input range, including edge cases.
  • Verify the worst case on small examples before and after coding.

Want interactive feedback?

Practice this problem in the live coding workspace while the interviewer probes your clarification, implementation, trade-offs, and validation.

Continue to Dashboard

Core Concepts

Hidden because they name the technique, which a real interviewer would not tell you.

Show core concepts
Math / CombinatoricsSearch StrategyWorst-Case Optimisation

Continue preparing

Build a complete software engineer mock interview plan

Prepare by company

Related Coding / DSA

Track Connectivity Across a Growing Network

Given a number of servers and a sequence of direct connection events between pairs of servers, answer whether two given servers are connected after each event, handling many connections and queries efficiently.

Related Coding / DSA

Reverse a Segment of a Linked List

Given the head of a singly linked list and two positions m and n, reverse the nodes from position m to position n in place and return the new head.

Related Coding / DSA

Search in a Rotated Sorted Array

Given an array of distinct integers that was originally sorted ascending and then rotated at an unknown pivot, determine the index of a target value or report that it is absent.