摘要:
https://leetcode.cn/problems/merge-intervals/description/ 经典题合并区间 class Solution { public int[][] merge(int[][] intervals) { Arrays.sort(intervals,(a, 阅读全文
posted @ 2024-08-29 18:36
风乐
阅读(21)
评论(0)
推荐(0)
摘要:
https://leetcode.cn/problems/partition-labels/description/ 听说这题是字节广告一面的题有两种做法,但是思路大致相同,主要思路是先求出所有字符的出现的最远距离,然后不断往后遍历,更新当前片段的最远距离 若是第一种做法,就是放在另一个循环中,不断 阅读全文
posted @ 2024-08-29 16:43
风乐
阅读(14)
评论(0)
推荐(0)
摘要:
https://leetcode.cn/problems/non-overlapping-intervals/description/ 贪心:思路是更新重叠的区间 class Solution { public int eraseOverlapIntervals(int[][] intervals) 阅读全文
posted @ 2024-08-29 15:38
风乐
阅读(17)
评论(0)
推荐(0)
摘要:
https://leetcode.cn/problems/minimum-number-of-arrows-to-burst-balloons/description/ 思路是排序,方便计算气球重叠,难点是在重叠时更新右边界,更新为 两个区间的最右重合点,因为这个点是最少一支箭就可以射掉两个气球的最 阅读全文
posted @ 2024-08-29 14:55
风乐
阅读(30)
评论(0)
推荐(0)

浙公网安备 33010602011771号