Skip to content

Commit edc5cc7

Browse files
committed
Create README - LeetHub
1 parent 602f25e commit edc5cc7

File tree

1 file changed

+28
-0
lines changed
  • 2929-distribute-candies-among-children-ii

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<h2><a href="https://leetcode.com/problems/distribute-candies-among-children-ii/?envType=daily-question&envId=2025-06-01">2929. Distribute Candies Among Children II</a></h2><h3>Medium</h3><hr><p>You are given two positive integers <code>n</code> and <code>limit</code>.</p>
2+
3+
<p>Return <em>the <strong>total number</strong> of ways to distribute </em><code>n</code> <em>candies among </em><code>3</code><em> children such that no child gets more than </em><code>limit</code><em> candies.</em></p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong class="example">Example 1:</strong></p>
7+
8+
<pre>
9+
<strong>Input:</strong> n = 5, limit = 2
10+
<strong>Output:</strong> 3
11+
<strong>Explanation:</strong> There are 3 ways to distribute 5 candies such that no child gets more than 2 candies: (1, 2, 2), (2, 1, 2) and (2, 2, 1).
12+
</pre>
13+
14+
<p><strong class="example">Example 2:</strong></p>
15+
16+
<pre>
17+
<strong>Input:</strong> n = 3, limit = 3
18+
<strong>Output:</strong> 10
19+
<strong>Explanation:</strong> There are 10 ways to distribute 3 candies such that no child gets more than 3 candies: (0, 0, 3), (0, 1, 2), (0, 2, 1), (0, 3, 0), (1, 0, 2), (1, 1, 1), (1, 2, 0), (2, 0, 1), (2, 1, 0) and (3, 0, 0).
20+
</pre>
21+
22+
<p>&nbsp;</p>
23+
<p><strong>Constraints:</strong></p>
24+
25+
<ul>
26+
<li><code>1 &lt;= n &lt;= 10<sup>6</sup></code></li>
27+
<li><code>1 &lt;= limit &lt;= 10<sup>6</sup></code></li>
28+
</ul>

0 commit comments

Comments
 (0)