---
# System prepended metadata

title: '[1431. Kids With the Greatest Number of Candies](https://leetcode.com/problems/kids-with-the-greatest-number-of-candies/)'

---

# [1431. Kids With the Greatest Number of Candies](https://leetcode.com/problems/kids-with-the-greatest-number-of-candies/)
![](https://i.imgur.com/NMTkyol.png)
![](https://i.imgur.com/olMoBOF.png)
bool* kidsWithCandies(int* candies, int candiesSize, int extraCandies, int* returnSize){

    bool *res = (bool *)malloc(candiesSize * sizeof(bool));

    int max = 0;
    for (int i = 0; i < candiesSize; ++i) {
        if(candies[i]>max)
        {
            max=candies[i];
        }
    }
    for (int i = 0; i < candiesSize; ++i) {
        res[i] = candies[i] + extraCandies >= max? true : false;
    }
    *returnSize = candiesSize;
    return res;
}
