public int treeDepth(TreeNode root) { if (root == null) return 0; return Math.max(treeDepth(root.left), treeDepth(root.right)) + 1; }
最后更新于4年前
这有帮助吗?