Leetcode 0056. Merge Intervals

Posted on Sun 13 November 2022 in Leetcode • Tagged with interval-merge

Question Link : https://leetcode.com/problems/merge-intervals/

Difficulty: Medium

Question

Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input.   Example 1:

Input: intervals = [[1,3],[2,6],[8,10 …


Continue reading

Leetcode 0057. Insert Interval

Posted on Sun 13 November 2022 in Leetcode • Tagged with interval-merge

Question Link : https://leetcode.com/problems/insert-interval/

Difficulty: Medium

Question

You are given an array of non-overlapping intervals intervals where intervals[i] = [starti, endi] represent the start and the end of the ith interval and intervals is sorted in ascending order by starti. You are also given an interval newInterval …


Continue reading

Leetcode 0435. Non-overlapping Intervals

Posted on Sun 13 November 2022 in Leetcode • Tagged with interval-merge, greedy

Question Link : https://leetcode.com/problems/non-overlapping-intervals/

Difficulty: Medium

Question

Given an array of intervals intervals where intervals[i] = [starti, endi], return the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.   Example 1:

Input: intervals = [[1,2],[2,3],[3,4],[1 …


Continue reading

Leetcode 0452. Minimum Number of Arrows to Burst Balloons

Posted on Sun 13 November 2022 in Leetcode • Tagged with interval-merge

Question Link : https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/

Difficulty: Medium

Question

There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array points where points[i] = [xstart, xend] denotes a balloon whose horizontal diameter stretches between xstart and xend …


Continue reading

Leetcode 0495. Teemo Attacking

Posted on Sun 13 November 2022 in Leetcode • Tagged with greedy, interval-merge, simulation

Question Link : https://leetcode.com/problems/teemo-attacking/

Difficulty: Easy

Question

Our hero Teemo is attacking an enemy Ashe with poison attacks! When Teemo attacks Ashe, Ashe gets poisoned for a exactly duration seconds. More formally, an attack at second t will mean Ashe is poisoned during the inclusive time interval …


Continue reading