Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9c5e627

Browse files
refactor 455
1 parent b365302 commit 9c5e627

File tree

1 file changed

+0
-28
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-28
lines changed

src/main/java/com/fishercoder/solutions/_455.java

-28
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,6 @@
22

33
import java.util.Arrays;
44

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-
335
public class _455 {
346

357
public static class Solution1 {

0 commit comments

Comments
 (0)