5 line C++ solution using memoization
\nunordered_map<TreeNode *,int> map;\n    int rob(TreeNode* root) \n    {\n        if(!root)\n            return 0;\n        if(map.count(root))\n            re
```\nunordered_map<TreeNode *,int> map;\n    int rob(TreeNode* root) \n    {\n        if(!root)\n            return 0;\n        if(map.count(root))\n            return map[root];\n        int total=0;\n        if(root->left)\n            total+= rob(root->left->left)+rob(root->left->right);\n        if(root->right)\n            total+=rob(root->right->left)+rob(root->right->right);\n        \n        return map[root]=max(root->val+total,rob(root->left)+rob(root->right));\n        \n    }\n```
['Dynamic Programming', 'Recursion', 'Memoization', 'C++']