Unique Binary Search Trees
Updated Feb 24, 2026
Problem
Return number of structurally unique BSTs that store values 1..n.
Constraints
1 <= n <= 19
Examples
Example 1
Input:
{"n": 3}
Output:
5
Function Signature
def numTrees(self, n: int) -> int
How to Submit
Implement a Solution class with a numTrees method.
Your method will be called with the input parameters and should return the answer.