MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / sumNumbers

Method sumNumbers

java/0129-sum-root-to-leaf-numbers.java:23–32  ·  view source on GitHub ↗
(TreeNode root)

Source from the content-addressed store, hash-verified

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){

Callers

nothing calls this directly

Calls 1

findLeafNodesMethod · 0.95

Tested by

no test coverage detected