leet code 1431. 拥有最多糖果的孩子
2020-06-01 00:50 woshihuangrulin 阅读(160) 评论(0) 编辑 收藏 举报class Solution { public: vector<bool> kidsWithCandies(vector<int>& candies, int extraCandies) { vector<bool> prob; int max = 0; for (const auto& c_num:candies) { if (c_num>max) { max = c_num; } } for (const auto& c_num:candies) { if (extraCandies+c_num >= max) { prob.emplace_back(true); } else { prob.emplace_back(false); } } return prob; } };