EASYasked at 1 company

Distribute Candies Among Children I

A easy-tier problem at 75% community acceptance, tagged with Math, Combinatorics, Enumeration. Reported in interviews at Rubrik and 0 others.

Founder's read

Distribute Candies Among Children I is the kind of problem that looks trivial until you realize you're overthinking it. It appears in assessments at Rubrik and has a 75% acceptance rate, which means a quarter of candidates are either misreading the constraints or getting caught in unnecessary complexity. The problem is rooted in basic combinatorics and enumeration, but the trick is recognizing when you can solve it with pure math instead of simulation. If you hit this during a live assessment and blank on the formula, StealthCoder surfaces a working solution in seconds, invisible to the proctor.

Companies asking
1
Difficulty
EASY
Acceptance
75%

Companies that ask "Distribute Candies Among Children I"

If this hits your live OA

Distribute Candies Among Children I 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 because the OA filter rejects engineers who'd pass the on-site. That's a broken filter. This is the workaround.

Get StealthCoder
What this means

The core pattern here is counting the number of ways to distribute identical items (candies) into distinct groups (children) subject to constraints. Most candidates either brute-force enumeration or try to code a recursive backtracking solution when the real answer is a closed-form combinatorial formula or a simple arithmetic sequence. The gotcha is the constraint interpretation. Read carefully whether each child must get at least one candy, whether candies are identical, and what the upper bounds are. Once you nail the constraint, the solution often compresses to a single formula or a tight loop. Common failure: writing a full recursive tree when the math solves it in one line. StealthCoder hedges this problem during the live OA if the combinatorial pattern doesn't click immediately.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Distribute Candies Among Children I 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 because the OA filter rejects engineers who'd pass the on-site. That's a broken filter. This is the workaround. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Distribute Candies Among Children I interview FAQ

Is this problem actually easy or is the 75% acceptance rate misleading?+

It's easy if you recognize the combinatorics pattern fast. The 25% miss rate likely comes from overthinking or misreading constraints. Once you identify the formula or enumeration structure, the code is short. Don't overcomplicate it.

What's the difference between this problem and a standard stars-and-bars combinatorics problem?+

This problem likely applies stars-and-bars logic or a variation of it, depending on whether children must receive at least one candy. If all candies are identical and distribution is unrestricted, it's textbook stars-and-bars. Read the constraint carefully.

Should I enumerate or use math?+

Check the input size first. Small ranges favor enumeration. Large ranges favor a mathematical formula. Given this is an easy problem, enumeration often works and is safer than deriving the formula under pressure.

Does Rubrik ask this in other forms or just this exact problem?+

Rubrik is the only reported company asking this problem. It's low frequency overall. If you see it, treat it as a warm-up rather than a show-stopper. Don't spend more than 10 minutes on it.

What's the biggest pitfall candidates hit?+

Misinterpreting whether candies are identical or distinguishable, or whether each child must get at least one. Spend 30 seconds reading the exact constraint before coding. That one detail changes the entire solution.

Want the actual problem statement? View "Distribute Candies Among Children I" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.