Glossary: Coding Interviews in JavaScript
Tree recursion
Pattern 6: return a base answer for an empty tree, ask each child for its answer, then combine them with the node's value. It costs O(n).
Glossary: Coding Interviews in JavaScript
Pattern 6: return a base answer for an empty tree, ask each child for its answer, then combine them with the node's value. It costs O(n).