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 challengesRanking Tree Validator

Gamified challenge · BST property

Ranking Tree Validator

tree is a ranking tree of player scores in level order with null for a missing spot (TreeNode in code). It is valid when, for every player, all scores in their left subtree are strictly smaller and all scores in their right subtree are strictly bigger. Scores can be any 32-bit integers.

Write isBst(tree) (Python: is_bst(tree)) that returns true if the tree is valid and false otherwise. An empty tree is valid. Checking each node only against its own children is not enough.

[2, 1, 3] is valid. [5, 3, 8, 1, 6, 7, 9] is not: 6 is a fine right child of 3, but it sits in the left subtree of 5 and 6 > 5.

Sign in to play Ranking Tree Validator

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