Dsa
Trees
Medium
Find Largest BST Subtree
Given a binary tree, return the size of the largest subtree that is also a binary search tree (BST). Print the size of this largest BST subtree.
Input format:
The input consists of a string that represents a binary tree in level order (e.g., '10,5,15,1,8,null,null').
Output format:
Print an integer representing the size of the largest BST subtree.
Example:
Input:
10,5,15,1,8,null,null
Output:
5
Key concepts
treesbinary search treesubtree
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