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

Method helper

src/com/blankj/easy/_0543/Solution.java:22–28  ·  view source on GitHub ↗
(TreeNode root)

Source from the content-addressed store, hash-verified

20 }
21
22 private int helper(TreeNode root) {
23 if (root == null) return 0;
24 int l = helper(root.left);
25 int r = helper(root.right);
26 if (l + r > max) max = l + r;
27 return Math.max(l, r) + 1;
28 }
29
30 public static void main(String[] args) {
31 Solution solution = new Solution();

Callers 1

diameterOfBinaryTreeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected