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

Method hasPathSum

java/0112-path-sum.java:27–29  ·  view source on GitHub ↗
(TreeNode root, int targetSum)

Source from the content-addressed store, hash-verified

25 return dfs(root.left, targetSum, currSum) || dfs(root.right, targetSum, currSum);
26 }
27 public boolean hasPathSum(TreeNode root, int targetSum) {
28 return dfs(root, targetSum, 0);
29 }
30}

Callers

nothing calls this directly

Calls 1

dfsMethod · 0.95

Tested by

no test coverage detected