diff --git a/problems/0104.二叉树的最大深度.md b/problems/0104.二叉树的最大深度.md index bf6d40a3..20cf4ef2 100644 --- a/problems/0104.二叉树的最大深度.md +++ b/problems/0104.二叉树的最大深度.md @@ -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)