~/boss / door-tree

Binary search tree lookup

The Door Maze

A tree of numbered doors. Find door 42 in 3 steps, without opening the rest.

Loading the fight…

How to beat it

Start at the root door. Your number is smaller? Go left. Bigger? Go right. Every step throws away half the tree. Run out of doors and the number isn't there: a balanced tree of a million doors takes about twenty steps.

Now the real boss

Interviews ask for the code. Watch it run, then write it yourself, tested in Python, C++ or Java.

On your phone? Writing code is easier on a laptop: open bossfight.dev/problems/search-in-a-binary-search-tree there. Sign in with your email to keep your progress on every device.

More bosses

esc