Problem title
Difficulty
Avg time to solve

Minimum Rotations
Easy
10 mins
Rotate DLL
Moderate
10 mins
Minimum shift Operations
Moderate
30 mins
Optimum Location
Hard
45 mins
Isomorphic Strings
Easy
15 mins
Merge Sort In-Place
Easy
--
Easy
10 mins
Reversing Queue
Easy
15 mins
Max Sum After 'K' Negations
Easy
15 mins
Arithmetic Expression Evaluation
Moderate
30 mins
1

# Unique BSTs

Difficulty: HARD
Contributed By
Avg. time to solve
50 min
Success Rate
50%

Problem Statement

#### You are given an integer ‘N’.Your task is to return the list of the root node of all the unique BST having values from 1 to N.

##### For Example
``````If N is 3,all unique BST will be:
``````

##### Input Format:
``````The first line of each test case contains a single integer, ‘N’, denoting the number.
``````
##### Output Format:
``````For each test case, print the level order traversal of all the unique BST formed.
``````
##### Note:
``````You do not need to print anything. It has already been taken care of. Just implement the given function.
``````
##### Constraints:
``````1 <= N <= 8.

Time limit: 1 sec
``````
##### Sample Input 1:
``````3
``````
##### Sample Output 1:
``````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
``````
##### Explanation of sample input 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).
``````

##### Sample Input 2:
``````2
``````
##### Sample Output 2:
``````1 -1 2 -1 -1
2 1 -1 -1 -1
``````
Console