mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-07 07:35:35 +08:00
Update0406.根据审稿重建队列,添加C#
This commit is contained in:
@ -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">
|
||||
|
Reference in New Issue
Block a user