Description: Solution: We have two list: start & end. ex) start: [0, 5, 15] end: [10, 20, 30] We shift the start pointer when start[s] is less than end[e] => count += 1 We shift the end pointer when start[s] is equal or more thn end[e] => count -= 1 Time Complexity: O(nlogn) Space Complexity: O(n)
Description: Solution: In this problem, we are gonna compare the end of the previous interval to the start of the current interval. If the new start point is bigger than prevEnd, we don't count. Else, it is overlapping, so that we count them as 1. And update prevEnd. Since, new intervals are still overlapping, we should use the min(end, prevEnd). Time Complexity: O(nlogn)