討論串[閒聊] 每日leetcode
共 1554 篇文章
內容預覽:
452. Minimum Number of Arrows to Burst Balloons. 照區間尾巴排. 然後射射射射射射射. 想了一段時間. interval好難. int findMinArrowShots(vector<vector<int>>& points) {. auto com
(還有289個字)
內容預覽:
Python Code:. class Solution:. def findMinArrowShots(self, points: List[List[int]]) -> int:. points.sort(key = lambda x: x[1]). res = 0. cur = 0. for
(還有105個字)
內容預覽:
先用右邊界整理. 然後開始射飛鏢. 在邊界外代表要多射一支. Code:. impl Solution {. pub fn find_min_arrow_shots(mut points: Vec<Vec<i32>>) -> i32 {. points.sort_unstable_by_key(|k
(還有603個字)
內容預覽:
題目:. 給你一串氣球陣列. 用垂直x軸的箭射破他們. 擦到邊就可以了. 問你最少要幾隻箭矢. 直接舉例說明比較快= =. [[1,3][3,7][10,11][10,12]]. 這裡的氣球需要兩隻箭. 射過3跟11. 就可以射破全部氣球了. 解法:. 反正都要看氣球. 就先排序好了. 排序之後.
(還有1582個字)