14ms java solution
 public int rob(TreeNode root) {\n        Map<TreeNode, Integer> include = new HashMap<>();\n        Map<TreeNode, Integer> exclude = new HashMap<>();\n        
     public int rob(TreeNode root) {\n        Map<TreeNode, Integer> include = new HashMap<>();\n        Map<TreeNode, Integer> exclude = new HashMap<>();\n        return helper(root, false, exclude, include);\n    }\n    \n    private int helper(TreeNode cur, boolean parentRobbed, Map<TreeNode, Integer> exclude, Map<TreeNode, Integer> include)\n    {\n        if (cur == null)\n        {\n            return 0;\n        }\n        \n        int ret = Integer.MIN_VALUE;\n        \n        int leftMax  = 0;\n        int rightMax = 0;\n       \n        // do not rob the current house\n        // ------------------------------------ \n        if (!exclude.containsKey(cur))\n        {\n            leftMax  = helper(cur.left, false, exclude, include);\n            rightMax = helper(cur.right, false, exclude, include);\n            exclude.put(cur, leftMax + rightMax);\n        }\n        ret = Math.max(ret, exclude.get(cur));\n        \n        // if parent house is not robbed, rob the current house\n        // ------------------------------------------------------------------\n        if (!parentRobbed)\n        {\n            // rob the current house\n            // ----------------------------\n            if (!include.containsKey(cur))\n            {\n                leftMax  = helper(cur.left, true, exclude, include);\n                rightMax = helper(cur.right, true, exclude, include);\n                include.put(cur, cur.val + leftMax + rightMax);\n            }\n            ret = Math.max(ret, include.get(cur));\n        }\n        \n        return ret;\n    }
[]