Loading the journal
Loading the journal
Precompute Max + Scan
5 recent
Go step by step: try it yourself before the video and the visual. Progress saves on this device.
Step 1
Know these before you start
Tick what you already know
Watch the concept video if the pattern is new to you.
Step 2
Try it on paper
5–10 minutes, no code yet
Community-reported · source · updated 2026-10-08. ● asked in the last 6 months.
There are n kids with candies. You are given an integer array candies, where candies[i] is the number of candies the ith kid has, and an integer extraCandies.
Return a boolean array result of length n, where result[i] is true if, after giving the ith kid all the extraCandies, they will have the greatest number of candies among all the kids, or false otherwise.
Multiple kids can have the greatest number of candies.
Input: candies = [2,3,5,1,3], extraCandies = 3
Output: [true,true,true,false,true]
Input: candies = [4,2,1,1,2], extraCandies = 1
Output: [true,false,false,false,false]
Input: candies = [12,1,12], extraCandies = 10
Output: [true,false,true]
n == candies.length
2 ≤ n ≤ 100
1 ≤ candies[i] ≤ 100
1 ≤ extraCandies ≤ 50
i doesn't change anyone else → the bar to beat is the current maxi qualifies iff candies[i] + extraCandies >= max(candies) (ties count)>=, not >trueStep 6
Get it accepted
All test cases pass
Step 7
Review it so it sticks
Re-solve from memory after
Reading the solution first feels like progress, but it makes the next similar problem — and the interview version — much harder, because you skipped the part where you figure it out. Give it an honest 20–30 minutes. Stuck? Re-read the pattern, watch the concept video, or try the brute force first.
Hidden: approach · solution code