Coding Challenge

Validate Binary Search Tree

Medium
treebstdfs

Check whether a binary tree satisfies BST rules.

Return true if the binary tree is a valid binary search tree where every node is greater than all nodes in its left subtree and smaller than all nodes in its right subtree.

Examples

Input: root = [2,1,3]

Output: true

Constraints

  • Node values may be large; watch numeric bounds

Preparing your coding workspace...