Merge pull request #80 from faiz-lab/master

添加0104.二叉树的最大深度 JavaScript版代码
This commit is contained in:
Carl Sun 2021-05-14 09:32:31 +08:00 committed by GitHub
commit 0d721c973a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -251,7 +251,13 @@ Python
Go
JavaScript
```javascript
var maxDepth = function(root) {
if (!root) return root
return 1 + Math.max(maxDepth(root.left), maxDepth(root.right))
};
```
-----------------------
* 作者微信:[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)