# 【LeetCode】96. Unique Binary Search Trees

Given n, how many structurally unique BST's (binary search trees) that store values 1...n?

For example,
Given n = 3, there are a total of 5 unique BST's.

   1         3     3      2      1
\       /     /      / \      \
3     2     1      1   3      2
/     /       \                 \
2     1         2                 3


class Solution {
public:
int numTrees(int n) {

long long c=1;
for(int i=1;i<=n;i++){
c=2*c*(2*(i-1)+1)/((i-1)+2);
}

return c;
}

};

#### LeetCode96:Unique Binary Search Trees

2015-06-24 15:56:10

#### leetcode-java-96. Unique Binary Search Trees

2016-06-30 10:08:42

#### LeetCode 96:Unique Binary Search Trees

2015-12-31 16:35:13

#### LeetCode || Unique Binary Search Trees

2014-04-09 23:16:41

#### 96 Unique Binary Search Trees

2015-11-25 21:04:50

#### [leetcode-96]Unique Binary Search Trees(c++)

2015-08-10 15:14:02

#### Unique Binary Search Trees -- LeetCode

2014-04-30 06:16:29

#### leetcode 95. Unique Binary Search Trees II | Java最短代码实现

2016-03-09 20:43:19

#### LeetCode(95)Unique Binary Search Trees II

2014-01-13 05:20:18

#### LeetCode | Unique Binary Search Trees II

2013-12-23 14:58:40