You are given the root of a binary tree, root.
Your task is to determine if it is a valid binary search tree (BST).
You may assume that:
node must contain only nodes with values less than the node's value.node must contain only nodes with values greater than the node's value.True
This is a valid BST. 5's left child (2) is smaller, and its right child (8) is larger. This property holds true for all nodes.
False
This is not a valid BST. Although 6 is greater than its parent (4), it is in the left subtree of the root (5). Therefore, all nodes in that subtree must be less than 5, which 6 is not.
False
This is not a valid BST. The node with value 1 is in the right subtree of the root (2), but 1 is not greater than 2.
True