![图片标题 图片说明](https://i-blog.csdnimg.cn/blog_migrate/e34e4d4afc215f6050afa88ddfc13230.png)
/**
*
* @param n int整型
* @return int整型
*/
//f(n)+=f(k-1)*f(n-k) k=1,2...n
function numTrees( n ) {
// write code here
if(n==0) return 1;
var arr =[]
arr[0] = 1
arr[1] = 1
for(var i=2;i<=n;i++){
arr[i] = 0
for(var j=1;j<=i;j++){
arr[i] += arr[j-1]*arr[i-j]
}
}
return arr[n]
}
module.exports = {
numTrees : numTrees
};