Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9cea156

Browse files
committed
Update0455.分发饼干,添加C#
1 parent 3bd387d commit 9cea156

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

‎problems/0455.分发饼干.md‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,28 @@ object Solution {
378378
}
379379
}
380380
```
381+
### C#
382+
```csharp
383+
public class Solution
384+
{
385+
public int FindContentChildren(int[] g, int[] s)
386+
{
387+
Array.Sort(g);
388+
Array.Sort(s);
389+
int index = s.Length - 1;
390+
int res = 0;
391+
for (int i = g.Length - 1; i >=0; i--)
392+
{
393+
if(index >=0 && s[index]>=g[i])
394+
{
395+
res++;
396+
index--;
397+
}
398+
}
399+
return res;
400+
}
401+
}
402+
```
381403

382404
<p align="center">
383405
<a href="https://programmercarl.com/other/kstar.html" target="_blank">

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /