# [1431. Kids With the Greatest Number of Candies](https://leetcode.com/problems/kids-with-the-greatest-number-of-candies/)   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; }
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up