1.Is This a Binary Search Tree
Input: root = [2,1,3]
Output: trueInput: root = [5,1,4,null,null,3,6]
Output: false
Explanation: The root node's value is 5 but its right child's value is 4.A binary search tree (BST) has the following properties.
• The left subtree of a node contains only nodes with keys less than the root node’s key.
• The right subtree of a node contains only nodes with keys greater than the root node’s key.
• Both the left and right subtrees must also be binary search trees.
From the above properties it naturally follows that:
• Each node (item in the tree) has a distinct key.
Using Inorder Traversal
Solution II
Last updated

