每日一题:https://leetcode.cn/problems/check-if-all-the-integers-in-a-range-are-covered/description/

题目链接:https://leetcode.cn/problems/check-if-all-the-integers-in-a-range-are-covered/description/

bool isCovered(int** ranges, int rangesSize, int* rangesColSize, int left, int right) {
int arr[60]={0};
for(int i=0;i<rangesSize;i++){
arr[ranges[i][0]]++;
arr[ranges[i][1]+1]--;
}
for(int i=1;i<51;i++){
arr[i]+=arr[i-1];
}
for(int i=left;i<=right;i++){
if(arr[i]<1)
return false;
}return true;
}

posted on 2024-11-17 18:32  神奇猫猫侠  阅读(1)  评论(0编辑  收藏  举报

导航