Posted on

Description

Submission

class Solution {
public:
    vector<bool> kidsWithCandies(vector<int>& candies, int extraCandies) {
        int m = *max_element(candies.begin(), candies.end());
        int n = candies.size();
        vector<bool> rets(n, false);
        for(int i = 0; i < n; ++i) {
            if(candies[i] + extraCandies >= m) rets[i] = true;
        }
        return rets;
    }
};

Leave a Reply

Your email address will not be published. Required fields are marked *