Kids With the Greatest Number of Candies
A easy-tier problem at 88% community acceptance, tagged with Array. Reported in interviews at Infosys and 0 others.
You're staring at a problem that looks trivial but shows up in your Infosys OA. Kids With the Greatest Number of Candies is one of those deceptive easy problems where the trap is overthinking it. With an 88% acceptance rate, most candidates breeze through, which means if you blank on the setup, you'll feel stupid. The reality: it's an array iteration problem with a single pass for the max, then a second loop to compare. If you hit this live and your brain stalls on how to structure the output, StealthCoder solves it in seconds invisible to the proctor.
Companies that ask "Kids With the Greatest Number of Candies"
Kids With the Greatest Number of Candies is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an engineer who got tired of watching his cohort grind for six months and still get filtered at the OA stage.
Get StealthCoderThe pattern is straightforward but candidates mess up the execution. You read an array of integers (candy counts), find the maximum, then return a boolean array saying whether each kid would have the most candy if you gave them an extra piece. The trap is doing it in more than two passes or building the answer incorrectly. Some candidates iterate while searching for max and building the result simultaneously, which breaks the logic. The correct move: one pass to find the max, one pass to build the answer array. Since it's Array topic only, no hidden trick with sorting or hashing. If you've drilled array problems, this is a warmup. If you haven't, StealthCoder is your hedge for the live assessment when the syntax or loop structure doesn't click.
Pattern tags
You know the problem.
Make sure you actually pass it.
Kids With the Greatest Number of Candies recycles across companies for a reason. It's easy-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an engineer who got tired of watching his cohort grind for six months and still get filtered at the OA stage. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Kids With the Greatest Number of Candies interview FAQ
Is this actually asked at Infosys, or is it a prep-site artifact?+
Infosys has reported asking it. With an 88% acceptance rate, it's a legitimate screen or early-stage problem, not a trick question. Treat it as real. If it shows up in your OA, it's expected to be fast and clean.
What's the gotcha that makes candidates mess this up?+
The gotcha is output format. Some return indices instead of booleans, or return a single max value instead of an array. Read the problem statement carefully. The answer is always an array of the same length as input, where each element is true or false.
Can I do this in one pass instead of two?+
No, not cleanly. You need to know the max before comparing. One pass to find max, one pass to build the answer. Trying to do both simultaneously makes your code fragile and slower in real time.
Is there a language where this is significantly harder?+
No. Array iteration and comparison work the same in every language. If you know the basics of loops and conditionals, this is mechanical. The hard part is staying calm and not second-guessing the simple solution.
If I see this in my OA, how much time should I spend?+
Two to five minutes. This is a freebie problem designed to boost confidence and acceptance rate. If you're taking longer, you're overcomplicating it. Write it, test with the example, move on to harder problems.
Want the actual problem statement? View "Kids With the Greatest Number of Candies" on LeetCode →