intervals

Solution) class Solution: def findMinArrowShots(self, points: List[List[int]]) -> int: # Initialization points.sort() res = [points[0]] for start, end in points[1:]: # If the cur interval and prev interval overlap # find the part that only overlaps with no leftover if start int: points.sort() res = [points[0]] for start, end in points[1:]: if start
Solution) def summaryRanges(self, nums: List[int]) -> List[str]: if not nums: return [] res = [] l, r = 0, 0 while r " + str(nums[r])) l = r+1 r += 1 if l == r: res.append(str(nums[r])) else: res.append(str(nums[l]) + "->" + str(nums[r])) return res Problem: LeetCode Time Complexity: ..
위대한먼지
'intervals' 태그의 글 목록