摘要:
贪心 按照有边界排序,只有先选择了右边边界小的,才可以放下更多的区间 class Solution { public: int eraseOverlapIntervals(vector<vector<int>>& intervals) { if(intervals.empty()) return 0 阅读全文
贪心 按照有边界排序,只有先选择了右边边界小的,才可以放下更多的区间 class Solution { public: int eraseOverlapIntervals(vector<vector<int>>& intervals) { if(intervals.empty()) return 0 阅读全文
posted @ 2022-11-08 19:30
破忒头头
阅读(25)
评论(0)
推荐(0)
摘要:
贪心算法 贪心策略:在每次遍历中,仅考虑并更新相邻一侧的大小关系 class Solution { public: int candy(vector<int>& ratings) { int size = ratings.size(); if(size<2){ return size; } vect 阅读全文
贪心算法 贪心策略:在每次遍历中,仅考虑并更新相邻一侧的大小关系 class Solution { public: int candy(vector<int>& ratings) { int size = ratings.size(); if(size<2){ return size; } vect 阅读全文
posted @ 2022-11-08 19:04
破忒头头
阅读(25)
评论(0)
推荐(0)
摘要:
贪心 class Solution { public: int findContentChildren(vector<int>& g, vector<int>& s) { sort(g.begin(),g.end()); sort(s.begin(),s.end()); int cd=0; int 阅读全文
posted @ 2022-11-08 19:04
破忒头头
阅读(22)
评论(0)
推荐(0)
浙公网安备 33010602011771号