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 b05f66d

Browse files
committed
Update0406.根据审稿重建队列,添加C#
1 parent 499d2af commit b05f66d

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

‎problems/0406.根据身高重建队列.md‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,29 @@ object Solution {
396396
}
397397
}
398398
```
399+
### C#
400+
```csharp
401+
public class Solution
402+
{
403+
public int[][] ReconstructQueue(int[][] people)
404+
{
405+
Array.Sort(people, (a, b) =>
406+
{
407+
if (a[0] == b[0])
408+
{
409+
return a[1] - b[1];
410+
}
411+
return b[0] - a[0];
412+
});
413+
var res = new List<int[]>();
414+
for (int i = 0; i < people.Length; i++)
415+
{
416+
res.Insert(people[i][1], people[i]);
417+
}
418+
return res.ToArray();
419+
}
420+
}
421+
```
399422

400423

401424
<p align="center">

0 commit comments

Comments
(0)

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