MCPcopy Create free account
hub / github.com/codedecks-in/LeetCode-Solutions / height

Method height

Java/Balanced-Binary-Tree.java:34–45  ·  view source on GitHub ↗
(TreeNode root)

Source from the content-addressed store, hash-verified

32 }
33
34 private int height(TreeNode root){
35 // calculate the height of a tree
36 if(root == null){
37 return 0;
38 }
39 else{
40 int left = height(root.left);
41 int right = height(root.right);
42 int height = left > right ? left : right;
43 return height + 1;
44 }
45 }
46}

Callers 1

isBalancedMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected