Assign Cookies LeetCode solution in Java
1class Solution {2public int findContentChildren(int[] g, int[] s) {3int i = 0, j = 0, c = 0;45Arrays.sort(g);6Arrays.sort(s);78for (; i < g.length; i++) {9// System.out.println(s[j]+" "+g[i]);1011while (j < s.length) {12if (s[j] >= g[i]) {13// System.out.println(s[j]+" "+g[i]);14j++;15c++;16break;17}18j++;19}20}2122return c;23}24}