Skip to content

#1431 - Kids With the Greatest Number of Candies

EasyArray / String
Open on LeetCode

Given an integer array candies where candies[i] is the number of candies the i-th kid has, and an integer extraCandies, return a boolean array result where result[i] is true if giving all extraCandies to kid i would give them the greatest (or tied-greatest) number of candies among all kids.

InputOutput
candies = [2,3,5,1,3], extraCandies = 3[true,true,true,false,true]
candies = [4,2,1,1,2], extraCandies = 1[true,false,false,false,false]
candies = [12,1,12], extraCandies = 10[true,false,true]

Released under the MIT License.