diff --git a/problems/0452.用最少数量的箭引爆气球.md b/problems/0452.用最少数量的箭引爆气球.md index 90cd7085..cd57f83b 100644 --- a/problems/0452.用最少数量的箭引爆气球.md +++ b/problems/0452.用最少数量的箭引爆气球.md @@ -332,6 +332,24 @@ object Solution { } } ``` +### C# +```csharp +public class Solution +{ + public int FindMinArrowShots(int[][] points) + { + if (points.Length == 0) return 0; + Array.Sort(points, (a, b) => a[0].CompareTo(b[0])); + int count = 1; + for (int i = 1; i < points.Length; i++) + { + if (points[i][0] > points[i - 1][1]) count++; + else points[i][1] = Math.Min(points[i][1], points[i - 1][1]); + } + return count; + } +} +```