Re: [閒聊] 每日leetcode
看板Marginalman作者DJYOSHITAKA (franchouchouISBEST)時間5月前 (2025/07/07 13:45)推噓0(0推 0噓 0→)留言0則, 0人參與討論串1462/1548 (看更多)
遭遇了前所未有的苦戰
幹==
好想跳出去當風箏
def maxEvents(self, events: List[List[int]]) -> int:
pq = []
events.sort()
idx, ans = 0, 0
for i in range(100001):
while idx<len(events) and events[idx][0]<=i:
heappush(pq, events[idx][1])
idx += 1
while pq and pq[0]<i:
heappop(pq)
if pq:
heappop(pq)
ans += 1
return ans
--
https://i.imgur.com/wRnmv7s.jpeg


--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.132.58.28 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1751867153.A.980.html
※ 編輯: DJYOSHITAKA (220.132.58.28 臺灣), 07/07/2025 13:47:27
討論串 (同標題文章)
完整討論串 (本文為第 1462 之 1548 篇):