Re: [閒聊] 每日leetcode

看板Marginalman作者 (franchouchouISBEST)時間1年前 (2024/03/19 00:08), 編輯推噓0(001)
留言1則, 1人參與, 1年前最新討論串58/1548 (看更多)
452. Minimum Number of Arrows to Burst Balloons 照區間尾巴排 然後射射射射射射射 想了一段時間 interval好難 int findMinArrowShots(vector<vector<int>>& points) { auto comp = [](vector<int>& x, vector<int>& y){ return x[1] < y[1]; }; sort(points.begin(), points.end(), comp); int ans = 1; int cur_x = points[0][1]; for(int i=1; i<points.size(); i++) { if(points[i][0] > cur_x) { cur_x = points[i][1]; ans++; } } return ans; } -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.137.247.129 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1710778129.A.114.html

03/19 00:09, 1年前 , 1F
大師
03/19 00:09, 1F
文章代碼(AID): #1b-6SH4K (Marginalman)
討論串 (同標題文章)
文章代碼(AID): #1b-6SH4K (Marginalman)