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

Function isRootBalanced

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

Source from the content-addressed store, hash-verified

58};
59
60var isRootBalanced = (root) => {
61 const isBaseCase = root === null;
62 if (isBaseCase) return [-1, true];
63
64 return dfs(root);
65};
66
67var dfs = (root) => {
68 const [left, isLeftBalanced] = isRootBalanced(root.left);

Callers 2

isBalancedFunction · 0.85
dfsFunction · 0.85

Calls 1

dfsFunction · 0.70

Tested by

no test coverage detected