Skip to content

Commit 242a356

Browse files
committed
96
1 parent 16c8769 commit 242a356

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

96(a).cpp

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

0 commit comments

Comments
 (0)