Update0455.分发饼干,添加C#

This commit is contained in:
eeee0717
2023-12-25 09:35:23 +08:00
parent 3bd387df7c
commit 9cea1567fe

View File

@ -378,6 +378,28 @@ object Solution {
}
}
```
### C#
```csharp
public class Solution
{
public int FindContentChildren(int[] g, int[] s)
{
Array.Sort(g);
Array.Sort(s);
int index = s.Length - 1;
int res = 0;
for (int i = g.Length - 1; i >=0; i--)
{
if(index >=0 && s[index]>=g[i])
{
res++;
index--;
}
}
return res;
}
}
```
<p align="center">
<a href="https://programmercarl.com/other/kstar.html" target="_blank">