Skip to content

Commit bf20089

Browse files
committed
Create README - LeetHub
1 parent 2973a3b commit bf20089

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

0455-assign-cookies/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<h2><a href="https://leetcode.com/problems/assign-cookies/">455. Assign Cookies</a></h2><h3>Easy</h3><hr><div><p>Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie.</p>
2+
3+
<p>Each child <code>i</code> has a greed factor <code>g[i]</code>, which is the minimum size of a cookie that the child will be content with; and each cookie <code>j</code> has a size <code>s[j]</code>. If <code>s[j] &gt;= g[i]</code>, we can assign the cookie <code>j</code> to the child <code>i</code>, and the child <code>i</code> will be content. Your goal is to maximize the number of your content children and output the maximum number.</p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong class="example">Example 1:</strong></p>
7+
8+
<pre><strong>Input:</strong> g = [1,2,3], s = [1,1]
9+
<strong>Output:</strong> 1
10+
<strong>Explanation:</strong> You have 3 children and 2 cookies. The greed factors of 3 children are 1, 2, 3.
11+
And even though you have 2 cookies, since their size is both 1, you could only make the child whose greed factor is 1 content.
12+
You need to output 1.
13+
</pre>
14+
15+
<p><strong class="example">Example 2:</strong></p>
16+
17+
<pre><strong>Input:</strong> g = [1,2], s = [1,2,3]
18+
<strong>Output:</strong> 2
19+
<strong>Explanation:</strong> You have 2 children and 3 cookies. The greed factors of 2 children are 1, 2.
20+
You have 3 cookies and their sizes are big enough to gratify all of the children,
21+
You need to output 2.
22+
</pre>
23+
24+
<p>&nbsp;</p>
25+
<p><strong>Constraints:</strong></p>
26+
27+
<ul>
28+
<li><code>1 &lt;= g.length &lt;= 3 * 10<sup>4</sup></code></li>
29+
<li><code>0 &lt;= s.length &lt;= 3 * 10<sup>4</sup></code></li>
30+
<li><code>1 &lt;= g[i], s[j] &lt;= 2<sup>31</sup> - 1</code></li>
31+
</ul>
32+
</div>

0 commit comments

Comments
 (0)