Login

All Problems

Problem title

Difficulty

Avg time to solve

Longest AP

Moderate

15 mins

Rabbits In Forest

Easy

15 mins

Path With Maximum Probability

Moderate

25 mins

Construct Quad Tree

Moderate

30 mins

Playing with the strings.

Easy

15 mins

Critical and Pseudo-Critical Edges

Hard

50 mins

Longest Bracket

Moderate

20 mins

Nobita’s Assignment

Moderate

30 mins

Find MSB In O(1)

Easy

10 mins

Count unique BSTs.

Hard

15 mins

Problem

Submissions

2

Avg. time to solve

15 min

Success Rate

85%

Problem Statement

```
The answer can be large, hence the return answer % ‘MOD’, where ‘MOD’ is a large prime number (10^9 + 7).
```

```
The first line contains a single integer ‘T’ representing the number of test cases.
The first line of each test case will contain a single integer ‘NUM’ where ‘NUM’ represents the number of keys.
```

```
For each test case, print a single line containing the count of total structurally unique binary search trees.
The output of each test case will be printed in a separate line.
```

```
You don’t need to print anything; It has already been taken care of. Just implement the given function.
```

```
1 <= T <= 100
1 <= NUM <= 500
Time limit: 1 sec
```

```
2
2
1
```

```
2
1
```

```
In the first test case, 2 unique BST are possible.
```

```
In the second test case, only 1 tree is possible.
```

```
2
3
4
```

```
5
14
```

```
In the first test case, 5 unique BST are possible.
```

```
In the second test case, similar to the above way, 14 unique BST are possible.
```

Console

Sample Test Case

Custom Test Case

Download Test Cases

Test Case 1

Test Case 2

Test Case 3

Saving Code...

Full Screen Mode

Change Language

Change Theme

Solution submission not allowed

Save Code

Reset Code