diff --git a/problems/0406.根据身高重建队列.md b/problems/0406.根据身高重建队列.md index 9cd78fac..b0b02c14 100644 --- a/problems/0406.根据身高重建队列.md +++ b/problems/0406.根据身高重建队列.md @@ -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(); + for (int i = 0; i < people.Length; i++) + { + res.Insert(people[i][1], people[i]); + } + return res.ToArray(); + } +} +```