Kids With the Most Candies
Kid i has candies[i] candies, where candies is the first argument. You have extra more candies to give to one kid.
Return a list of booleans: item i is True if giving all extra candies to kid i would leave that kid with at least as many candies as every other kid, otherwise False. Each answer is considered separately.
Example 1
candies [2,3,5,1,3]
extra 3
returns [true,true,true,false,true]
The most any kid has is 5. Kid 0 would have 5 (True), kid 3 would have 4 (False).
Constraints
1 <= len(candies) <= 500 <= candies[i], extra <= 20
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Arrays problems
- Largest At Least Twice OthersBeginner
- Longest Increasing RunBeginner
- Max Consecutive OnesBeginner
- Peak So FarBeginner
- Running Sum of an ArrayBeginner
- Second AppearanceBeginner
- Shift Right and FillBeginner
- Shuffle the ArrayBeginner