3199. Distribute Candies Among Children I
My accepted Python solution to LeetCode problem 3199, Distribute Candies Among Children I, running in 13ms.
- Difficulty: Easy
- Python
- Runtime 13ms
- Memory 17.5MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 13ms, memory 17.5MB, accepted 2026-01-02.
class Solution:
def distributeCandies(self, n: int, limit: int) -> int:
count = 0
for i in range(min(n, limit) + 1):
for j in range(min(n - i, limit) + 1):
k = n - i - j
if 0 <= k <= limit:
count += 1
return count