3. Kids With the Greatest Number of Candies
candies[i] is how many candies kid i has, and you also hold extraCandies spare
candies.
For each kid, imagine giving them all of the spare candies. Would they then have at least as many candies as every other kid (ties count)? Return a list of booleans with the answer for each kid, in order.
Constraints
2 <= len(candies) <= 1001 <= candies[i] <= 1001 <= extraCandies <= 50
Examples
Example 1
Input: candies = [3,6,2,5,1], extraCandies = 2 Output: [false,true,false,true,false]
Example 2
Input: candies = [7,1,1,1], extraCandies = 1 Output: [true,false,false,false]
Example 3
Input: candies = [10,4,9], extraCandies = 3 Output: [true,false,true]
Hints
Hint 1
Find the current maximum once.
Hint 2
Kid i qualifies exactly when candies[i] + extraCandies >= that maximum.