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
In the first test case, 2 unique BST are possible.
In the second test case, only 1 tree is possible.
2 3 4
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.