My 12ms C++ solution
\n\n     int rob(TreeNode node, int& lm, int& rm) {\n        if (!node)  return 0;\n        int lm1 = 0, lm2 = 0, rm1 = 0, rm2 = 0;\n        \n        lm = rob(
 \n\n     int rob(TreeNode* node, int& lm, int& rm) {\n        if (!node)  return 0;\n        int lm1 = 0, lm2 = 0, rm1 = 0, rm2 = 0;\n        \n        lm = rob(node->left, lm1, rm1);\n        rm = rob(node->right, lm2, rm2);\n        \n        return max(node->val + lm1 + rm1 + lm2 + rm2, lm + rm);\n      }\n\n     int rob(TreeNode* root) {\n        int res = 0;\n        int lm = 0, rm = 0;\n        res = rob(root, lm, rm);\n        return res;\n     }\n\n - **lm** is the max rob value of node->left\n - **rm** is the max rob value of node->right\n - **lm1** is the max rob value of node->left->left (Same as **lm2**)\n - **rm1** is the max rob value of node->left->right (Same as **rm2**)\n - So the max rob value of node is the max value between **(lm + rm)** and **(node->val + lm1 + lm2 + rm1 + rm2)**
['C++']