Class Solution
java.lang.Object
g0001_0100.s0096_unique_binary_search_trees.Solution
96 - Unique Binary Search Trees.<p>Medium</p>
<p>Given an integer <code>n</code>, return <em>the number of structurally unique **BST’**s (binary search trees) which has exactly</em> <code>n</code> <em>nodes of unique values from</em> <code>1</code> <em>to</em> <code>n</code>.</p>
<p><strong>Example 1:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2021/01/18/uniquebstn3.jpg" alt="" /></p>
<p><strong>Input:</strong> n = 3</p>
<p><strong>Output:</strong> 5</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> n = 1</p>
<p><strong>Output:</strong> 1</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= n <= 19</code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
numTrees
public int numTrees(int n)
-