力扣2251.花期内花的数目

力扣2251.花期内花的数目

  • 差分

    • 1e9数据范围优雅的写法
cpp 复制代码
  class Solution {
  public:
      vector<int> fullBloomFlowers(vector<vector<int>>& flowers, vector<int>& persons) {
          map<int,int> mp;
          for(auto &it:flowers) mp[it[0]] ++ , mp[it[1] + 1] --;
          for(auto x:persons) mp[x];
  
          int tot = 0;
          for(auto &[x,y] : mp)
              y = (tot += y);
          for(auto &x:persons)
              x = mp[x];
          return persons;
      }
  };
相关推荐
测试老哥1 小时前
接口自动化测试分层设计与实践总结
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·接口测试
风栖柳白杨2 小时前
【面试】职位要求_准备
面试·职场和发展
geovindu2 小时前
go:Backtracking Algorithm
开发语言·后端·算法·golang·回溯算法
微露清风2 小时前
模拟算法学习记录
学习·算法
KaMeidebaby3 小时前
卡梅德生物技术快报 | abcore 纳米抗体文库:从PNAS论文看纳米抗体理性设计:构象熵作为亲和力预测新指标的技术实现
java·开发语言·人工智能·算法·机器学习
问商十三载3 小时前
2026法律行业AI引擎生成式优化怎么优化?三层专业加固提排名,零成本提33%引用率附适配表
java·前端·人工智能·算法
zander2583 小时前
138. 随机链表的复制
数据结构·算法·链表
过期动态3 小时前
【LeetCode 热题 100】找到字符串中所有字母异位词
java·数据结构·算法·leetcode·职场和发展·rabbitmq
来一碗刘肉面3 小时前
栈在递归中的应用
数据结构·算法