Concise C++ DP DFS Solution
\nclass Solution {\npublic:\n    pair<int, int> dfs(TreeNode* root) {\n        if(!root) return {0, 0};\n        auto [leftDontRob, leftRob]   = dfs(root -> lef
```\nclass Solution {\npublic:\n    pair<int, int> dfs(TreeNode* root) {\n        if(!root) return {0, 0};\n        auto [leftDontRob, leftRob]   = dfs(root -> left);\n        auto [rightDontRob, rightRob] = dfs(root -> right);\n        return {\n            max(leftDontRob, leftRob) + max(rightDontRob, rightRob),\n            root -> val + leftDontRob + rightDontRob\n        };\n    }\n      int rob(TreeNode* root) {\n        auto ans = dfs(root);\n        return max(ans.first, ans.second);\n    }\n};\n```\n**Please Upvote\nthank you!!**
['Dynamic Programming', 'Depth-First Search', 'C', 'C++']