Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. public class Solution {
  2. public int findContentChildren(int[] g, int[] s) {
  3. Arrays.sort(s);
  4. Arrays.sort(g);
  5. int res = 0;
  6. for (int i = 0; i < s.length && res < g.length; i++) {
  7. if (s[i] >= g[res]) res++;
  8. }
  9. return res;
  10. }
  11. }
  12. /*
  13. [1,2,3]
  14. [1,1]
  15. [10,9,8,7]
  16. [5,6,7,8]
  17. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement