Best Python Solution (Clean, Explained)
Explaination\nI learn the answer from @realisking, I couldn\'t come up with such elegant solution myself.\n\nOn every node we got two option, to rob or not to r
# Explaination\nI learn the answer from @realisking, I couldn\'t come up with such elegant solution myself.\n\nOn every node we got two option, to rob or not to rob\n* To rob this node, then we cannot rob our left and right child, so the max value would be the total of\n    * value of this node\n    * the max value from left child, when we not rob the left child\n    * the max value from right child, when we not rob the right child\n* Not to rob this node, means that we can either rob or not rob our left and right child, so the max value would be the total of\n    * 0, because we choose not to rob this node\n    * the max of `rob the left child` and `not rob the left child`\n    * the max of `rob the right child` and `not rob the right child`\n\n`get_max_value(node)` returns the `max value when we rob this node` and `max value when we not rob this node` on each node.\nSo we get the max from the two returns from `get_max_value(root)`\n\nThe time complexity is `O(LogN)`, because we keep calling `get_max_value()` until the very bottom of the tree.\nThe space complexity is `O(LogN)`, too. Even we only use `O(1)` of space on every `get_max_value()`\nBut we used `LogN` level of recursion. `N` is the number of houses.\n\n# Code\n```\nclass Solution(object):\n    def rob(self, root):\n        def get_max_value(node):\n            if node is None: return 0, 0\n            left_rob, left_not_rob = get_max_value(node.left)\n            right_rob, right_not_rob = get_max_value(node.right)\n\n            rob = node.val+left_not_rob+right_not_rob\n            not_rob = max(left_rob, left_not_rob)+max(right_rob, right_not_rob)\n\n            return rob, not_rob\n\n        return max(get_max_value(root))\n```\n\n# More Resource\nI really take time tried to make the best solution or explaination. \nBecause I wanted to help others like me. \nIf you like my answer, a star on [GitHub](https://github.com/wuduhren/leetcode-python) means a lot to me. \nhttps://github.com/wuduhren/leetcode-python
[]