1ms Java Solution
public int rob(TreeNode root) {\n        int[] maxVal = dpRob(root);\n        return Math.max(maxVal[0], maxVal[1]);\n    }\n    \n    public int[] dpRob(TreeNo
    public int rob(TreeNode root) {\n        int[] maxVal = dpRob(root);\n        return Math.max(maxVal[0], maxVal[1]);\n    }\n    \n    public int[] dpRob(TreeNode root) {\n        if (root == null) {\n            return new int[]{0, 0};\n        } else {\n            int[] maxVal = new int[2];//maxVal[0] store the max value without robing current node, maxVal[1] store the max value with robing current node,\n            int[] leftMax = dpRob(root.left);\n            int[] rightMax = dpRob(root.right);\n            maxVal[0] = Math.max(leftMax[0], leftMax[1]) + Math.max(rightMax[0], rightMax[1]);\n            maxVal[1] = leftMax[0] + rightMax[0] + root.val;\n            return maxVal;\n        }\n    }
[]