Update0406.根据审稿重建队列,添加C#
This commit is contained in:
parent
499d2afb61
commit
b05f66d853
|
|
@ -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">
|
<p align="center">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue