MCPcopy
hub / github.com/HuberTRoy/leetCode / helper

Method helper

DFS/PathSum.py:44–57  ·  view source on GitHub ↗
(prev, root, sum)

Source from the content-addressed store, hash-verified

42 return False
43
44 def helper(prev, root, sum):
45 if prev + root.val == sum:
46 if not root.left and not root.right:
47 return True
48
49 if root.left:
50 if helper(prev + root.val, root.left, sum):
51 return True
52
53 if root.right:
54 if helper(prev + root.val, root.right, sum):
55 return True
56
57 return False
58
59 return helper(0, root, sum)

Callers

nothing calls this directly

Calls 1

helperFunction · 0.50

Tested by

no test coverage detected