Kids With the Greatest Number of Candies
EasyGreedy
Decode it first. Clues, constraints, pattern and plan before any code.Kid i has candies[i] candies, and you have extra_candies to hand out. For each kid, imagine giving all of the extra candies to that one kid. Would they then have the greatest number of candies (ties count)? Return a list of booleans, one per kid.
candies = [2, 3, 5, 1, 3], extra_candies = 3 → [true, true, true, false, true]
candies = [4, 2, 1, 1, 2], extra_candies = 1 → [true, false, false, false, false]Constraints
2 <= candies.length <= 1001 <= candies[i] <= 1001 <= extra_candies <= 50