# 不同的二叉搜索树

<div class="notranslate">
    <p>给你一个整数 <code>n</code> ，求恰由 <code>n</code> 个节点组成且节点值从 <code>1</code> 到 <code>n</code> 互不相同的 <strong>二叉搜索树</strong>
        有多少种？返回满足题意的二叉搜索树的种数。</p>

    <p>&nbsp;</p>

    <p><strong>示例 1：</strong></p>
    <img style="width: 600px; height: 148px;" src="https://assets.leetcode.com/uploads/2021/01/18/uniquebstn3.jpg"
        alt="">
    <pre><strong>输入：</strong>n = 3
<strong>输出：</strong>5
    </pre>

    <p><strong>示例 2：</strong></p>

    <pre><strong>输入：</strong>n = 1
<strong>输出：</strong>1
    </pre>

    <p>&nbsp;</p>

    <p><strong>提示：</strong></p>

    <ul>
        <li><code>1 &lt;= n &lt;= 19</code></li>
    </ul>
</div>

## template

```python
class Solution(object):
	def numTrees(self, n):
		"""
		:type n: int
		:rtype: int
		"""
		dp = [0] * (n + 1)
		dp[0] = 1
		dp[1] = 1
		for level in range(2, n + 1):
			for root in range(1, level + 1):
				dp[level] += dp[level - root] * dp[root - 1]
		return dp[n]
# %%
s = Solution()
print(s.numTrees(n = 3))
```

## 答案

```python

```

## 选项

### A

```python

```

### B

```python

```

### C

```python

```