mediumBinary Search TreeBinary TreeDynamic ProgrammingMathTree 0 views

Unique Binary Search Trees

Given an integer n, return the number of structurally unique BST's (binary search trees) which has exactly n nodes of unique values from 1 to n.

Given an integer n, return the number of structurally unique BST's (binary search trees) which has exactly n nodes of unique values from 1 to n.

Example 1

Input: n = 3

Output: 5

Example 2

Input: n = 1

Output: 1

Constraints

  • 1 <= n <= 19

Hints

No hints yet.

Companies

No companies reported yet.

Discussion

Sign in to join the discussion.

Loading discussion...

Test results

No test cases yet.