力扣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;
      }
  };
相关推荐
Yeats_Liao1 分钟前
评估体系构建:基于自动化指标与人工打分的双重验证
运维·人工智能·深度学习·算法·机器学习·自动化
cpp_25015 分钟前
P9586 「MXOI Round 2」游戏
数据结构·c++·算法·题解·洛谷
浅念-9 分钟前
C语言编译与链接全流程:从源码到可执行程序的幕后之旅
c语言·开发语言·数据结构·经验分享·笔记·学习·算法
有时间要学习24 分钟前
面试150——第五周
算法·深度优先
晚霞的不甘1 小时前
Flutter for OpenHarmony 可视化教学:A* 寻路算法的交互式演示
人工智能·算法·flutter·架构·开源·音视频
望舒5131 小时前
代码随想录day25,回溯算法part4
java·数据结构·算法·leetcode
C++ 老炮儿的技术栈2 小时前
Qt 编写 TcpClient 程序 详细步骤
c语言·开发语言·数据库·c++·qt·算法
KYGALYX2 小时前
逻辑回归详解
算法·机器学习·逻辑回归
铉铉这波能秀2 小时前
LeetCode Hot100数据结构背景知识之集合(Set)Python2026新版
数据结构·python·算法·leetcode·哈希算法
参.商.2 小时前
【Day 27】121.买卖股票的最佳时机 122.买卖股票的最佳时机II
leetcode·golang