MCPcopy Create free account
hub / github.com/Blankj/awesome-java-leetcode / maxDepth

Method maxDepth

src/com/blankj/easy/_0104/Solution.java:15–18  ·  view source on GitHub ↗
(TreeNode root)

Source from the content-addressed store, hash-verified

13 */
14public class Solution {
15 public int maxDepth(TreeNode root) {
16 if (root == null) return 0;
17 return 1 + Math.max(maxDepth(root.left), maxDepth(root.right));
18 }
19
20 public static void main(String[] args) {
21 Solution solution = new Solution();

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected