333. Largest BST Subtree

Problem

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
Hints
Related Problems

333. Largest BST Subtree

Find the size of the largest subtree of a binary tree that is itself a valid BST.