摘要: 贪心 class Solution { int num = 0; public int minCameraCover(TreeNode root) { /** * 如果根节点未被监视,需要单独放一个摄像头 */ if (dfs(root) == 0){ num++; } return num; } 阅读全文
posted @ 2022-02-27 11:08 振袖秋枫问红叶 阅读(53) 评论(0) 推荐(0)
摘要: 动态规划 class Solution { public int maxProfit(int[] prices, int fee) { int[][] dp = new int[prices.length][2]; dp[0][0] = -prices[0]; /** * 和《122. 买卖股票的最 阅读全文
posted @ 2022-02-27 10:22 振袖秋枫问红叶 阅读(56) 评论(0) 推荐(0)