MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / dfs

Function dfs

javascript/0110-balanced-binary-tree.js:39–46  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

37};
38
39var dfs = (root) => {
40 const left = getHeight(root.left);
41 const right = getHeight(root.right);
42
43 const height = Math.max(left, right);
44
45 return height + 1;
46};
47
48/**
49 * https://leetcode.com/problems/balanced-binary-tree/

Callers 2

getHeightFunction · 0.70
isRootBalancedFunction · 0.70

Calls 2

isRootBalancedFunction · 0.85
getHeightFunction · 0.70

Tested by

no test coverage detected