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

Function goodNodes

javascript/1448-Count-Good-Nodes-in-Binary-Tree.js:7–11  ·  view source on GitHub ↗
(root, max = -Infinity, total = [ 0 ])

Source from the content-addressed store, hash-verified

5 * @return {number}
6 */
7 var goodNodes = function(root, max = -Infinity, total = [ 0 ]) {
8 count(root, max, total);
9
10 return total[0]
11};
12
13const count = (root, max, total) => {
14 const isBaseCase = root === null;

Callers

nothing calls this directly

Calls 2

countFunction · 0.70
bfsFunction · 0.70

Tested by

no test coverage detected