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

Function dfs

javascript/0938-range-sum-of-bst.js:22–27  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

20 let total = 0;
21
22 const dfs = (node) => {
23 if (!node) return;
24 if (node.val >= low && node.val <= high) total += node.val;
25 dfs(node.left);
26 dfs(node.right);
27 };
28 dfs(root);
29 return total;
30};

Callers 1

rangeSumBSTFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected