Update 0452.用最少数量的箭引爆气球,添加C#

This commit is contained in:
eeee0717
2024-01-05 14:08:10 +08:00
parent 709b5babf0
commit 55d676e194

View File

@ -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;
}
}
```
<p align="center"> <p align="center">
<a href="https://programmercarl.com/other/kstar.html" target="_blank"> <a href="https://programmercarl.com/other/kstar.html" target="_blank">