Skip to content
playdsa
Preferences

Make yourself comfortable.

Saved on this browser. Your device’s reduced-motion preference is always respected.

Theme
Advanced settings

Boss fightThe Ordered Ancestor

Learn
Play
Prove
Problem context and objectives
Mission briefing

Archive pathfinder · Clues branch through a living archive

Explore only the branches that can still contain the answer: The Ordered Ancestor.

Ignoring the parent-child rule turns a focused search into a full maze traversal.

How you win

  1. 1Recognize when Lowest common ancestor in BST matches the clues
  2. 2Keep this true after every move: the current subtree still contains both target values
  3. 3Reach the result within O(height) time and O(1) space

Rules and pressure

  • Target cost: O(height) time and O(1) space
  • State rule: the current subtree still contains both target values
Lesson 1 of 3

Keep target band [2, 8] together in the BST; move when the band lies on one side, otherwise stop.

Stop immediately when the target band straddles the root.

Your call · What should happen with target band [2,8] at current node 6?

Help shape PlayDSA

Something confusing, broken, or missing? Leave a quick note without leaving your lesson.

Please leave out passwords, payment details and other private information.

Page included: /

Sign in to save feedback here, or send it with your email app. Your draft stays here while you sign in.

Open email instead