Skip to content

Commit

Permalink
Update0406.根据审稿重建队列,添加C#
Browse files Browse the repository at this point in the history
  • Loading branch information
eeee0717 committed Jan 4, 2024
1 parent 499d2af commit b05f66d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions problems/0406.根据身高重建队列.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,29 @@ object Solution {
}
}
```
### C#
```csharp
public class Solution
{
public int[][] ReconstructQueue(int[][] people)
{
Array.Sort(people, (a, b) =>
{
if (a[0] == b[0])
{
return a[1] - b[1];
}
return b[0] - a[0];
});
var res = new List<int[]>();
for (int i = 0; i < people.Length; i++)
{
res.Insert(people[i][1], people[i]);
}
return res.ToArray();
}
}
```


<p align="center">
Expand Down

0 comments on commit b05f66d

Please sign in to comment.