Practice Distribute Candies Among Children I
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given two positive integers n and limit. Return the total number of ways to distribute n candies among 3 children such that no child gets more than limit candies.
Source: Distribute Candies Among Children I on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
n = 5, limit = 2
Output
3
# Example 2
Input
n = 3, limit = 3
Output
10
Constraints
1 <= n <= 50
1 <= limit <= 50
Related LeetCode Problems
Practice more problems similar to Distribute Candies Among Children I.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.