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

Function count

javascript/1448-Count-Good-Nodes-in-Binary-Tree.js:13–18  ·  view source on GitHub ↗
(root, max, total)

Source from the content-addressed store, hash-verified

11};
12
13const count = (root, max, total) => {
14 const isBaseCase = root === null;
15 if (isBaseCase) return 0;
16
17 return dfs(root, max, total);
18}
19
20const dfs = (root, max, total) => {
21 const isGood = max <= root.val

Callers 2

goodNodesFunction · 0.70
dfsFunction · 0.70

Calls 1

dfsFunction · 0.70

Tested by

no test coverage detected