Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. const findLargestLevel = function(node) {
  2. //set a variable to hold the largest sum;
  3. var largestSum = 0;
  4. //set a variable to hold the current sum
  5. var currentSum = 0;
  6.  
  7. // search the tree
  8. //check the node, if there's children
  9. //sum the children values
  10. //compare with the largest sum
  11. //if larger, overwrite with the new sum
  12.  
  13. return largestSum
  14. //return the largest sum
  15. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement