Quant Memo
Coding/●●●●●

Is this price-ordered tree a valid BST?

A binary search tree requires that every node in a left subtree is smaller, and every node in a right subtree is larger, than the parent, a global rule, not merely a local parent/child check. Verify whether a given tree is a valid BST.

      5
     / \
    3   8       -> True
   / \
  1   4

      5
     / \
    3   8
       / \
      4   9     -> False   # 4 is in 8's left subtree but < 5

Return whether the tree satisfies the BST property.

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions