Description
Given an integer n, return the number of structurally unique BST's which has exactly n nodes of unique values from 1 to n.
Examples
Input:
n = 3Output:
5Explanation:
There are 5 unique BSTs with 3 nodes.
Input:
n = 1Output:
1Explanation:
With only 1 node, there is exactly 1 possible BST structure.
Input:
n = 4Output:
14Explanation:
With 4 nodes, the number of structurally unique BSTs is 14.
Constraints
- •
1 ≤ n ≤ 19