GamifiedGamified challengesPracticeRaceLeaderboardPricing

Learn data structures by watching them move, then doing it yourself. Press M anytime to toggle sound.

A product of Amypo Technologies, Coimbatore.

Learn

  • All topics
  • Learning path
  • How it works
  • About dotprep

Practice

  • Practice arena
  • Daily challenge
  • Gamified challenges
  • Race mode
  • Leaderboard

Interview prep

  • Java interview
  • Coding questions
  • Company questions
  • System design
  • Jobs & careers

You

  • Dashboard
  • Settings
  • Pricing
  • Create account

© 2026 dotprep

Content last updated 20 November 2026

GamifiedGamified challengesPracticeRaceLeaderboardPricing
Log inStart free
Gamified challengesGuess the Floor

Gamified challenge · Binary search

Guess the Floor

A prize is hidden on one floor of a tower with floors 1..n. After each guess the lift operator replies higher, lower or here. The tower's rule: every guess must be a middle floor of the floors still possible (when an even number of floors is left, either of the two middle ones is fine).

The operator can't talk to your code, so you are told the prize floor secret instead. Write guess(n, secret) that returns the list of floors you would guess, in order, ending with the guess that hits secret. The checker replays the operator's replies and rejects any guess that isn't a middle floor of what is left.

Example: guess(10, 7) returns [5, 8, 6, 7]: 5 → higher (6..10 left), 8 → lower (6..7 left), 6 → higher, 7 → here. [6, 9, 8, 7] (always the upper middle) or [5, 8, 7] would also be accepted.

Sign in to play Guess the Floor

This game is part of the paid plans. Sign in, then pick a plan to write your answer, watch it play out, and step through the algorithm with its guide.

Sign in with Google

or log in with email · create an account