Find the size of the largest subtree of a binary tree that is itself a valid BST.
Given the root of a binary tree, find the largest subtree that is also a valid Binary Search Tree. Return the size (number of nodes) of this largest BST subtree.
Examples
Input:[1]
Output:1
Input:[1,null,2]
Output:2
Hints
Use DFS post-order to check if each subtree is a valid BST.
Return min, max, size, and valid flag from each recursive call.
Update the global maximum size when a valid BST is found.