mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-09 03:34:02 +08:00
Merge pull request #80 from faiz-lab/master
添加0104.二叉树的最大深度 JavaScript版代码
This commit is contained in:
@ -251,7 +251,13 @@ Python:
|
|||||||
Go:
|
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)
|
* 作者微信:[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)
|
||||||
|
Reference in New Issue
Block a user