class Solution {
public:
vector<bool> kidsWithCandies(vector<int>& candies, int extraCandies) {
int maxValue=*max_element(candies.begin(),candies.end());
vector<bool>res;
for(int i=0;i<candies.size();i++)
{
if(candies[i]+extraCandies>=maxValue)
{
res.push_back(true);
}
else
{
res.push_back(false);
}
}
return res;
}
};
LeetCode:1431. 拥有最多糖果的孩子
最新推荐文章于 2020-09-17 18:19:23 发布