Coding

Validate if a given tree is a valid binary search tree.

Given the root of a binary tree, determine if it is a valid binary search tree (BST). A valid BST is defined as follows: The left subtree of a node contains only nodes with keys less than the node's key, and the right subtree contains only nodes with keys greater than the node's key.

Input: root = [5,1,4,null,null,3,6]

Output: FALSE

Explanation: Node 4 is in the right subtree of Node 5, but 4 is less than 5, which violates the BST property.

Was asked at

Practice this question with AI

First session is free - no credit card required.

Go Premium

More interviews, more skills, more success.

Practice More Questions

1 answer published. Last candidate submission on Jun 6 2026, 9:35pm PDT. Interview question asked to Software Engineers interviewing at Informatica, Drive.ai, Eventbrite and other companies. Original question asked: Validate if a given tree is a valid binary search tree.. Question last reported by a candidate interviewing at ApplyBoard for a Software Engineer interview on Jul 18 2026, 8:41pm PDT.