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

Jonescy

关注

阅读 73

2023-03-08


问题 ​​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)

0 0 举报