LC: 333. Largest BST Subtree
https://leetcode.com/problems/largest-bst-subtree/
PreviousLC: 708. Insert into a Sorted Circular Linked ListNextLC: 1428. Leftmost Column with at Least a One
Last updated
https://leetcode.com/problems/largest-bst-subtree/
Last updated
Input: root = [10,5,15,1,8,null,7]
Output: 3
Explanation: The Largest BST Subtree in this case is the highlighted one. The return value is the subtree's size, which is 3.Input: root = [4,2,7,2,3,5,null,2,null,null,null,null,null,1]
Output: 2/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode() {}
* TreeNode(int val) { this.val = val; }
* TreeNode(int val, TreeNode left, TreeNode right) {
* this.val = val;
* this.left = left;
* this.right = right;
* }
* }
*/
class Solution {
public int largestBSTSubtree(TreeNode root) {
}
}