0
点赞
收藏
分享

微信扫一扫

LeetCode力扣 104. 二叉树的最大深度 Maximum Depth of Binary Tree 题解代码 JavaScript


问题 ​​https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/submissions/​​

练习使用JavaScript解答

/**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {TreeNode} root
* @return {number}
*/
var maxDepth = function(root) {
if(!root)
return 0;
return Math.max(arguments.callee(root.left), arguments.callee(root.right)) + 1;
};

 

举报

相关推荐

0 条评论