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

Method depth

java/Chapter 4/Question4_9/Question.java:31–37  ·  view source on GitHub ↗
(TreeNode node)

Source from the content-addressed store, hash-verified

29 }
30
31 public static int depth(TreeNode node) {
32 if (node == null) {
33 return 0;
34 } else {
35 return 1 + Math.max(depth(node.left), depth(node.right));
36 }
37 }
38
39 public static void findSum(TreeNode node, int sum) {
40 int depth = depth(node);

Callers 1

findSumMethod · 0.95

Calls 1

maxMethod · 0.80

Tested by

no test coverage detected