Untitled
unknown
plain_text
2 years ago
293 B
6
Indexable
def func(root):
if root.left is None and root.right is None:
return [str(root.value)]
return [i + str(root.value) for i in func(root.left)] + [i + str(root.value) for i in func(root.right)]
def solve(root):
paths = sum(int(i[::-1], 2) for i in func(root))
return pathsEditor is loading...
Leave a Comment