Given a binary tree containing one or more BSTs, find the size of the the largest BST subtree.
Note: The smallest answer would be 1. The largest answer would be n where the entire binary tree is a BST.
The first line contains an integer T denoting the number of test cases.
For each test case, the input has 2 lines:
For each test case, the output has a single integer containing the size of the largest binary tree.
3
12
1 2 6 1 5 8 -1 -1 -1 4 -1 7
12
6 2 9 1 5 8 -1 -1 -1 4 -1 7
3
28 14 11
4
8
1
1 <= T <= 10
1 <= n <= 104
1 <= node value <= 104