File tree 1 file changed +0
-28
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +0
-28
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import java .util .Arrays ;
4
4
5
- /**
6
- * 455. Assign Cookies
7
- *
8
- * Assume you are an awesome parent and want to give your children some cookies.
9
- * But, you should give each child at most one cookie.
10
- * Each child i has a greed factor gi, which is the minimum size of a cookie
11
- * that the child will be content with;
12
- * and each cookie j has a size sj. If sj >= gi, we can assign the cookie j to the child i,
13
- * and the child i will be content. Your goal is to maximize the number of your content children and output the maximum number.
14
-
15
- Note:
16
- You may assume the greed factor is always positive.
17
- You cannot assign more than one cookie to one child.
18
-
19
- Example 1:
20
- Input: [1,2,3], [1,1]
21
- Output: 1
22
- Explanation: You have 3 children and 2 cookies. The greed factors of 3 children are 1, 2, 3.
23
- 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.
24
- You need to output 1.
25
-
26
- Example 2:
27
- Input: [1,2], [1,2,3]
28
- Output: 2
29
- Explanation: You have 2 children and 3 cookies. The greed factors of 2 children are 1, 2.
30
- You have 3 cookies and their sizes are big enough to gratify all of the children,
31
- You need to output 2.*/
32
-
33
5
public class _455 {
34
6
35
7
public static class Solution1 {
You can’t perform that action at this time.
0 commit comments