C# simple solutiom


  • 0
    D
    public class Solution {
        public int FindContentChildren(int[] g, int[] s) {
            int k=0;
            Array.Sort(g);
            Array.Sort(s);
            for(int i=0;i<s.Length;i++)
            {
                if(k<g.Length && s[i]>=g[k])
                k++;
                else if(k>g.Length)
                break;
            }
            return k;
        }
    }
    

Log in to reply
 

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