129. 求根到叶子节点数字之和

回溯算法:

  1. 本题的deliverable是所有路径的组合,也没有任何剪枝

  2. 开始先判空,if not root: return 0

  3. 回溯路径 root.left,root.right ; 每次往下层递归,则加上本层的root.val

  4. 更新常数的时候要用全局变量

原文地址:https://www.cnblogs.com/ChevisZhang/p/13612324.html