Merge pull request #142 from QuinnDK/添加0096不同的二叉搜索树Go版本

添加0096不同的二叉搜索树Go版本
This commit is contained in:
Carl Sun 2021-05-16 11:42:18 +08:00 committed by GitHub
commit 25958826de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 1 deletions

View File

@ -189,7 +189,18 @@ Python
Go
```Go
func numTrees(n int)int{
dp:=make([]int,n+1)
dp[0]=1
for i:=1;i<=n;i++{
for j:=1;j<=i;j++{
dp[i]+=dp[j-1]*dp[i-j]
}
}
return dp[n]
}
```