Untitled
unknown
plain_text
a year ago
293 B
5
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 paths
Editor is loading...
Leave a Comment