05 2022 档案
摘要:56. 合并区间 class Solution { public int[][] merge(int[][] intervals) { //按左边界排 相等则右边界 Arrays.sort(intervals, (o1, o2) -> { if (o1[0] == o2[0]) return Int
阅读全文
摘要:435. 无重叠区间 class Solution { public int eraseOverlapIntervals(int[][] intervals) { //转化为找无重叠区间个数的问题 //按右边界排序 Arrays.sort(intervals, (o1, o2) -> { if (o
阅读全文
摘要:406. 根据身高重建队列 class Solution { public int[][] reconstructQueue(int[][] people) { //问题设计两个维度 h和k 需先确定一个维度 再来考虑解决另一个维度 //k不能先解决,因为k的合理性有h确定 所以先解决h //身高由
阅读全文
摘要:135. 分发糖果 class Solution { public int candy(int[] ratings) { int len = ratings.length; if (len == 0) return 0; //分配数组 int[] alot = new int[len]; //先从前
阅读全文