Beats 100% Java Easy Solution DP
\nclass Solution {\n    public int rob(TreeNode root) {\n        if(root == null)\n            return 0;\n        int[] result = helper(root);\n        return M
```\nclass Solution {\n    public int rob(TreeNode root) {\n        if(root == null)\n            return 0;\n        int[] result = helper(root);\n        return Math.max(result[0], result[1]);\n    }\n    public int[] helper(TreeNode root){\n        if(root == null){\n            int[] result = {0, 0};\n            return result;\n        }\n        int[] result = new int[2];\n        int[] left = helper(root.left);\n        int[] right = helper (root.right);\n        result[0] = root.val + left[1] + right[1];\n        result[1] = Math.max(left[0], left[1]) + Math.max(right[0], right[1]);\n        return result;\n    }\n}\n```
['Dynamic Programming', 'Tree', 'Depth-First Search', 'Recursion', 'Java']