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

Method helper

Tree/SumRootToLeafNumbers.py:63–72  ·  view source on GitHub ↗
(root, string)

Source from the content-addressed store, hash-verified

61 return 0
62
63 def helper(root, string):
64 if not root.left and not root.right:
65 result.append(int(string+str(root.val)))
66 return
67
68 if root.left:
69 helper(root.left, string+str(root.val))
70
71 if root.right:
72 helper(root.right, string+str(root.val))
73 helper(root, '')
74 return sum(result)

Callers

nothing calls this directly

Calls 1

helperFunction · 0.50

Tested by

no test coverage detected