Dsa
Binary Search Tree
Medium
Validate BST
You are given a binary search tree (BST). Your task is to validate whether it is a valid BST. A binary search tree is valid if for every node, all values in its left subtree are less than the node's value, and all values in its right subtree are greater than the node's value. The input consists of a string representation of the BST. The BST representation is a level-order traversal with 'null' for empty nodes.
Input Format:
The first line contains the level-order string of the BST.
Output Format:
Print 'True' if the BST is valid, otherwise print 'False'.
Example:
Input:
2,1,3
Output:
True
Key concepts
binary_search_treevalidationinorder_traversal
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now