Kids With the Greatest Number of Candies

Easy

candies[i] is how many candies child i has. After giving extraCandies to one child, return a boolean array where result[i] says whether that child then has the most candies.

Example 1

kidsWithCandies()
Input
candies = [2,3,5,1,3], extraCandies = 3
Output
[true,true,true,false,true]

Example 2

kidsWithCandies()
Input
candies = [4,2,1,1,2], extraCandies = 1
Output
[true,false,false,false,false]
Constraints
1 <= candies.length <= 100
1 <= candies[i] <= 100
1 <= extraCandies <= 50

Topics

Arrays

Implement kidsWithCandies in the editor and return the answer — printing it is never graded.