LeetCode ๐Ÿ”๏ธ/Interval

LeetCode ๐Ÿ”๏ธ/Interval

38. Meeting Rooms II

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)

LeetCode ๐Ÿ”๏ธ/Interval

37. Meeting Rooms

Description: Solution: Note that the range should begin from index 1. Time Complexity: O(nlogn)

LeetCode ๐Ÿ”๏ธ/Interval

435. Non-overlapping Intervals

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)

LeetCode ๐Ÿ”๏ธ/Interval

56. Merge Intervals

Description: Solution: start, end is the intervals[i] = [start[i], end[i]]. Time Complexity: O(nlogn)

LeetCode ๐Ÿ”๏ธ/Interval

57. Insert Interval

Description: Solution: Time Complexity: O(n)

KB0129
'LeetCode ๐Ÿ”๏ธ/Interval' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก