C++ | Simple Solution
\nclass Solution {\npublic:\n    vector<int> helper(TreeNode* root){\n        if(!root) return {0, 0, 0};\n        \n        vector<int> temp = {0, 0, 0};\n    
```\nclass Solution {\npublic:\n    vector<int> helper(TreeNode* root){\n        if(!root) return {0, 0, 0};\n        \n        vector<int> temp = {0, 0, 0};\n        \n        vector<int> l = helper(root->left);\n        vector<int> r = helper(root->right);\n        \n        temp[1] = max(l[1]+r[1], root->val+l[0]+l[2]+r[0]+r[2]);\n        temp[0] = l[1];\n        temp[2] = r[1];\n        \n        return temp;\n    }\n    \n    int rob(TreeNode* root) {\n        vector<int> temp = helper(root);\n        return temp[1];\n    }\n};\n```
[]