MCPcopy Create free account
hub / github.com/betomoedano/JavaScript-Coding-Interview-Questions / branchSums

Function branchSums

binary-trees/branch-sums.js:30–32  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

28// time O(n) where n is the number of nodes
29// space O(n)
30function branchSums(root) {
31 return branchSumsHelper(root, 0, (sums = []));
32}
33
34function branchSumsHelper(root, currentSum, sums) {
35 if (root !== null) {

Callers 1

branch-sums.jsFile · 0.85

Calls 1

branchSumsHelperFunction · 0.85

Tested by

no test coverage detected