Easy to understand(java)
public class Solution {\n    \n    public int rob(TreeNode root) {\n        if (root == null) return 0;\n        return Math.max(robInclude(root), robExclude(ro
public class Solution {\n    \n    public int rob(TreeNode root) {\n        if (root == null) return 0;\n        return Math.max(robInclude(root), robExclude(root));\n    }\n    \n    public int robInclude(TreeNode node) {\n        if(node == null) return 0;\n        return robExclude(node.left) + robExclude(node.right) + node.val;\n    }\n    \n    public int robExclude(TreeNode node) {\n        if(node == null) return 0;\n        return rob(node.left) + rob(node.right);\n    }\n}
[]