var numTrees = function(n) {
const G = new Array(n+1).fill(0);
G[0] = 1;
G[1] = 1;
for(let i=2;i<=n;i++){
for(let j=1;j<=i;j++){
G[i] += G[j-1]*G[i-j];
}
}
return G[n];
};
力扣第96题-不同的二叉搜索树
- 本文链接:http://gulinga.github.io/2022/11/17/arithmetic/LeetCode%E7%83%AD%E9%A2%98HOT100/96/
- 版权声明:本博客所有文章除特别声明外,均默认采用 许可协议。