Skip to content

Commit 4bb767a

Browse files
committed
96
1 parent 340a4a6 commit 4bb767a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

96.cpp

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
class Solution {
2+
public:
3+
int numTrees(int n) {
4+
5+
int A[n+1];
6+
A[0]=1;
7+
A[1]=1;
8+
// A[2]=2;
9+
for(int j=2;j<=n;j++)
10+
{
11+
int count=0;
12+
for(int i=0;i<j;i++)
13+
{
14+
count+=(A[i]*A[j-1-i]);
15+
}
16+
A[j]=count;
17+
18+
}
19+
20+
return A[n];
21+
22+
}
23+
};

0 commit comments

Comments
 (0)