Problem :

https://leetcode.com/problems/house-robber-iii/


My Solution :

# Definition for a binary tree node.
# class TreeNode:
#     def __init__(self, x):
#         self.val = x
#         self.left = None
#         self.right = None

class Solution:
    def rob(selfroot):
        def find(node):
            if node:
                left = find(node.left)
                right = find(node.right)
                return (max(left) + max(right),
                        node.val + left[0] + right[0])
            return (00)

        return max(find(root))