Open underwindfall opened 2 years ago
https://leetcode-cn.com/problems/house-robber-iii/
思路
[ ] 刷15mins
[ ] 刷5mins
public int rob(TreeNode root) { if (root == null) return 0; int val1 = root.val; if (root.left != null) val1 += rob(root.left.left) + rob(root.left.right); if (root.right != null) val1 += rob(root.right.left) + rob(root.right.right); int val2 = rob(root.left) + rob(root.right); return Math.max(val1, val2); }
https://leetcode-cn.com/problems/house-robber-iii/
思路
[ ] 刷15mins
[ ] 刷5mins