(TreeNode root)
| 21 | */ |
| 22 | |
| 23 | public int sumNumbers(TreeNode root) { |
| 24 | // track the sum that we want to add |
| 25 | int solution = 0; |
| 26 | |
| 27 | // execute a dfs to find the leaf nodes |
| 28 | solution = findLeafNodes(root, solution); |
| 29 | |
| 30 | // return the solution |
| 31 | return solution; |
| 32 | } |
| 33 | |
| 34 | // dfs method |
| 35 | public int findLeafNodes(TreeNode node, int currentPath){ |
nothing calls this directly
no test coverage detected