MCPcopy Index your code
hub / github.com/careercup/ctci / getHeight

Method getHeight

java/Chapter 4/Question4_1/QuestionBrute.java:8–13  ·  view source on GitHub ↗
(TreeNode root)

Source from the content-addressed store, hash-verified

6public class QuestionBrute {
7
8 public static int getHeight(TreeNode root) {
9 if (root == null) {
10 return 0;
11 }
12 return Math.max(getHeight(root.left), getHeight(root.right)) + 1;
13 }
14
15 public static boolean isBalanced(TreeNode root) {
16 if (root == null) {

Callers 1

isBalancedMethod · 0.95

Calls 1

maxMethod · 0.80

Tested by

no test coverage detected