摘要: class Solution { public int minFlipsMonoIncr(String s) { int oneNum = 0, flipNum =0; int res =0; for(char c: s.toCharArray()){ if(c=='0'){ if(oneNum== 阅读全文
posted @ 2022-03-22 06:09 阳光明媚的菲越 阅读(12) 评论(0) 推荐(0) 编辑
摘要: By adding a 'max' and 'min' variable, we can make the solution's time complexity from O(n3) to O(n2): public long subArrayRanges(int[] nums) { long re 阅读全文
posted @ 2022-03-22 05:19 阳光明媚的菲越 阅读(31) 评论(0) 推荐(0) 编辑
摘要: Solution 1, Using a PriorityQueue class Solution { public int maximumUnits(int[][] boxTypes, int truckSize) { PriorityQueue<int[]> queue = new Priorit 阅读全文
posted @ 2022-03-22 03:53 阳光明媚的菲越 阅读(17) 评论(0) 推荐(0) 编辑