Search
⌘K
Get Premium
Leetcode 2929. Distribute Candies Among Children II
Count the number of nonnegative integer triples (a,b,c) with a + b + c = n and 0 ≤ a,b,c ≤ limit. With n, limit up to 1e6, the task is to compute this count efficiently using combinatorics (stars-and-bars with inclusion–exclusion) rather than brute force.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.