We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 891b970 commit 10ef206Copy full SHA for 10ef206
src/com/gatsby/_455AssignCookies.java
@@ -0,0 +1,28 @@
1
+package com.gatsby;
2
+
3
+import java.util.Arrays;
4
5
+/**
6
+ * @ClassName: _455AssignCookies
7
+ * @Description:
8
+ * @author: Gatsby
9
+ * @date: 2022/7/25 13:34
10
+ */
11
12
+public class _455AssignCookies {
13
+ public int findContentChildren(int[] appetite, int[] biscuits) {
14
+ Arrays.sort(appetite);
15
16
+ Arrays.sort(biscuits);
17
+ int children = 0;
18
+ int a = appetite.length;
19
+ int b = biscuits.length;
20
+ for (int i = 0, j = 0; i < a && j < b; ++i, ++j) {
21
+ while (j < b && biscuits[j] < appetite[i]) ++j;
22
+ if (j < b) children++;
23
+ }
24
+ return children;
25
26
+}
27
28
0 commit comments