Leetcode 1478 Solution
This article provides solution to leetcode question 1478 (maximum-number-of-events-that-can-be-attended)
Access this page by simply typing in "lcs 1478" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
class Solution: def maxEvents(self, events: List[List[int]]) -> int: events.sort() begin_day = events end_day = max([end_day for _, end_day in events]) day = begin_day q =  i = 0 ans = 0 while day <= end_day: while i < len(events) and events[i] <= day: heapq.heappush(q, events[i]) i += 1 if q: heapq.heappop(q) ans += 1 while q and q <= day: heapq.heappop(q) day += 1 return ans