Skip to content

Commit 2bce04c

Browse files
authored
Create Unique BST
1 parent cbecf38 commit 2bce04c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Unique BST

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class Solution {
2+
public:
3+
int numTrees(int n)
4+
{
5+
if (n==0) return 0;
6+
double ans=1, j=1;
7+
for(int i=n+1;i<=2*n;i++)
8+
{
9+
ans*=i;
10+
ans/=j++;
11+
cout<<ans<<" ";
12+
13+
}
14+
ans/=n+1;
15+
16+
return(int(ans));
17+
}
18+
};

0 commit comments

Comments
 (0)