图解找递推公式
const int N = 20;
class Solution {
public:
int dp[N];
int numTrees(int n) {
dp[0] = 1;
for (int i = 1; i <= n; i ++)
for (int j = 0; j <= i - 1; j ++)
dp[i] += dp[j] * dp[i - j - 1];
return dp[n];
}
};
标签:int,二叉,搜索,LeetCode,dp,96
From: https://www.cnblogs.com/hjy94wo/p/16729802.html