Simple Java Solution


  • 0
    S

    '''

       public int findContentChildren(int[] g, int[] s) {
        
    
        Arrays.sort(g);
        Arrays.sort(s);
        
        int length1 = g.length;
        int length2 = s.length;
        
        int i = 0 , j = i  ;
        
        while(i<length1 && j<length2){
            
            if(g[i]<=s[j]) i++;
            
            
            j++;
        
            
        }
        
        return i;
    }
    

    '''


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.