摘要:
贪心思想:尽量在父节点上放摄像头 用后序遍历,三种状态: 0: 无摄像头,并且没被覆盖 -1: 无摄像头,且被覆盖了 1: 有摄像头 class Solution { int num=0; public int minCameraCover(TreeNode root) { if(postOrder 阅读全文
posted @ 2022-02-22 17:38
livingsu
阅读(31)
评论(0)
推荐(0)
摘要:
贪心: class Solution { public int maxProfit(int[] prices, int fee) { int n=prices.length; int low=prices[0]; int ans=0; for(int i=1;i<n;i++){ if(prices[ 阅读全文
posted @ 2022-02-22 13:42
livingsu
阅读(29)
评论(0)
推荐(0)
摘要:
class Solution { public int monotoneIncreasingDigits(int n) { char[] arr=Integer.toString(n).toCharArray(); int len=arr.length; int k=len; for(int i=l 阅读全文
posted @ 2022-02-22 13:18
livingsu
阅读(27)
评论(0)
推荐(0)

浙公网安备 33010602011771号