Update0406.根据审稿重建队列,添加C#

This commit is contained in:
eeee0717
2024-01-04 10:41:09 +08:00
parent 499d2afb61
commit b05f66d853

View File

@ -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">