Problem of the day
If N is 3,all unique BST will be:
The first line of each test case contains a single integer, βNβ, denoting the number.
For each test case, print the level order traversal of all the unique BST formed.
You do not need to print anything. It has already been taken care of. Just implement the given function.
1 <= N <= 8.
Time limit: 1 sec
3
1 -1 3 2 -1 -1 -1
1 -1 2 -1 3 -1 -1
2 1 3 -1 -1 -1 -1
3 2 -1 1 -1 -1 -1
3 1 -1 -1 2 -1 -1
For the first test case,
There exist 5 unique BST for the values 1 to 3. So, the given arrays are the level order traversal for each unique BST. (Empty Node is denoted by -1).
2
1 -1 2 -1 -1
2 1 -1 -1 -1