CT026

Count All Possible BSTs

MediumAcceptance: 0.0%

The Codetikki mathematicians study how many structurally unique binary search trees can be formed using values [1, 2, ..., n]. Given an integer n, count the number of structurally unique BSTs that can be formed using values from 1 to n. Output the count.

Example 1:

Input: 3
Output: 5

Example 2:

Input: 1
Output: 1

Constraints:

1 <= n <= 19

Tags:

binary-search-tree trees dynamic-programming math
Loading...
Test Cases:No test cases
No test cases available.