payal-kothari
7/25/2017 - 5:57 PM

From https://leetcode.com/problems/assign-cookies/#/description

public class Solution {
    public int findContentChildren(int[] g, int[] s) {
        
        Arrays.sort(g);
        Arrays.sort(s);
        
        int i=0, ans = 0;
        
        for(int j=0 ; i< g.length && j<s.length; j++){
            if(s[j] >= g[i]){
                i++;
            }
        }
        
        return i;
        
    }
}