Kids With the Greatest Number of Candies
Easy
LC #1431
arrayhidden costNot attempted yet
candies[i] is how many candies kid i has. You
have extra_candies more to give away, all to one kid.
Return a list of booleans: True at position i if
giving kid i all the extra candies would leave them
with at least as many as every other kid.
Example 1
Input: candies = [2, 3, 5, 1, 3], extra_candies = 3
Output: [True, True, True, False, True]
The max is 5. Kid 3 reaches only 1 + 3 = 4.
Example 2
Input: candies = [4, 2, 1, 1, 2], extra_candies = 1
Output: [True, False, False, False, False]
Example 3
Input: candies = [10, 1, 10], extra_candies = 9
Output: [True, True, True]
Ties count as the greatest.
Constraints
- 1 ≤ candies.length ≤ 10⁵
- 0 ≤ candies[i], extra_candies ≤ 10⁹