Skip to content

Commit 6289169

Browse files
authored
Create 0455-assign-cookies.kt
1 parent 92640ff commit 6289169

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

kotlin/0455-assign-cookies.kt

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution {
2+
fun findContentChildren(g: IntArray, s: IntArray): Int {
3+
g.sort()
4+
s.sort()
5+
6+
var i = 0
7+
var j = 0
8+
while (i < g.size) {
9+
while (j < s.size && g[i] > s[j]) j++
10+
if (j == s.size) break
11+
i++
12+
j++
13+
}
14+
15+
return i
16+
}
17+
}

0 commit comments

Comments
 (0)