Java | postorder | 0 ms 100% faster
So the idea here is to keep track of the sum with including the current node and without including the current node. \n\n\tpublic int rob(TreeNode root) {\n    
So the idea here is to keep track of the sum **with** including the current node and **without** including the current node. \n\n\tpublic int rob(TreeNode root) {\n        if (root == null) return 0;\n        int[] res = postOrder(root);\n        return Math.max(res[0], res[1]);\n    }\n    \n    private int[] postOrder(TreeNode node) {\n\t\tif (node == null) return new int[2];\n        int[] l = postOrder(node.left);\n        int[] r = postOrder(node.right);\n\n        int with = node.val + l[1] + r[1];\n        int without = Math.max(l[0], l[1]) + Math.max(r[0], r[1]);\n\n        return new int[]{with, without};\n    }
[]