Problem
There are n kids. The item candies[i] is the number of candies that kid i has. You also have extra_candies candies to give away.
For each kid, suppose that you give all of extra_candies to that kid only. Then check if that kid has the greatest number of candies. More than one kid can have the greatest number.
Return a list of booleans. Item i is true if kid i has the greatest number in this case. Otherwise, item i is false.
Example 1
- Input:
- candies = [4,1,6,3], extra_candies = 2
- Output:
- [true,false,true,false]
- Explanation:
- The greatest number is 6. Kid 0 gets
4 + 2 = 6, but kid 3 gets only3 + 2 = 5.
Example 2
- Input:
- candies = [7,7,2], extra_candies = 5
- Output:
- [true,true,true]
- Explanation:
- Kid 2 gets
2 + 5 = 7. This number is equal to the greatest number, so item 2 istrue.
Example 3
- Input:
- candies = [10,3,8], extra_candies = 1
- Output:
- [true,false,false]
Constraints
- n == candies.length
- 2 <= n <= 100
- 1 <= candies[i] <= 100
- 1 <= extra_candies <= 50
SysRound wrote this statement. A reference solution checks every example.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 1431. Kids With the Greatest Number of Candies
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source