Python 3 | DFS, Backtracking | Explanation
Explanation\n- It\'s a tree, there is an implied recursion relation between each layer\n- Two options:\n\t- Take value in current node, then the direct children
### Explanation\n- It\'s a tree, there is an implied recursion relation between each layer\n- Two options:\n\t- Take value in current node, then the direct children node can\'t be taken, but we can take the maximum below its direct children\n\t- Don\'t take value in current node, then we take the maximum below current node\n- Return the maximum of root can get\n### Implementation\n```\nclass Solution:\n    def rob(self, root: TreeNode) -> int:\n        def dfs(node):\n            if not node: return 0, 0\n            left, right = dfs(node.left), dfs(node.right)\n            v_take = node.val + left[1] + right[1]\n            v_not_take = max(left) + max(right)\n            return v_take, v_not_take\n        return max(dfs(root))\n```\nHere is a 1-liner in Python 3.8\n```\nclass Solution:\n    def rob(self, root: TreeNode) -> int:\n        def dfs(node):\n            return (node.val + (left:=dfs(node.left))[1] + (right:=dfs(node.right))[1], max(left) + max(right)) if node else (0, 0)\n        return max(dfs(root))\n```
['Backtracking', 'Depth-First Search', 'Python', 'Python3']