This commit is contained in:
youngyangyang04
2021-12-01 12:36:50 +08:00
parent 5ffd1de55b
commit 331d3a4839
3 changed files with 116 additions and 22 deletions

View File

@@ -5,7 +5,7 @@
<p align="center"><strong><a href="https://mp.weixin.qq.com/s/tqCxrMEU-ajQumL1i8im9A">参与本项目</a>,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们收益!</strong></p>
## 452. 用最少数量的箭引爆气球
# 452. 用最少数量的箭引爆气球
[力扣题目链接](https://leetcode-cn.com/problems/minimum-number-of-arrows-to-burst-balloons/)
@@ -17,29 +17,27 @@
示例 1
输入points = [[10,16],[2,8],[1,6],[7,12]]
输出2
解释对于该样例x = 6 可以射爆 [2,8],[1,6] 两个气球,以及 x = 11 射爆另外两个气球
* 输入points = [[10,16],[2,8],[1,6],[7,12]]
* 输出2
* 解释对于该样例x = 6 可以射爆 [2,8],[1,6] 两个气球,以及 x = 11 射爆另外两个气球
示例 2
输入points = [[1,2],[3,4],[5,6],[7,8]]
输出4
* 输入points = [[1,2],[3,4],[5,6],[7,8]]
* 输出4
示例 3
输入points = [[1,2],[2,3],[3,4],[4,5]]
输出2
* 输入points = [[1,2],[2,3],[3,4],[4,5]]
* 输出2
示例 4
输入points = [[1,2]]
输出1
* 输入points = [[1,2]]
* 输出1
示例 5
输入points = [[2,3],[2,3]]
输出1
* 输入points = [[2,3],[2,3]]
* 输出1
提示:
* 0 <= points.length <= 10^4
* points[i].length == 2
* -2^31 <= xstart < xend <= 2^31 - 1
@@ -136,7 +134,7 @@ public:
## 其他语言版本
Java
### Java
```java
class Solution {
public int findMinArrowShots(int[][] points) {
@@ -156,7 +154,7 @@ class Solution {
}
```
Python
### Python
```python
class Solution:
def findMinArrowShots(self, points: List[List[int]]) -> int:
@@ -171,8 +169,7 @@ class Solution:
return result
```
Go
### Go
```golang
func findMinArrowShots(points [][]int) int {
var res int =1//弓箭数
@@ -196,8 +193,9 @@ func min(a,b int) int{
}
return a
}
```
Javascript:
```
### Javascript
```Javascript
var findMinArrowShots = function(points) {
points.sort((a, b) => {
@@ -216,7 +214,7 @@ var findMinArrowShots = function(points) {
};
```
C:
### C
```c
int cmp(const void *a,const void *b)
{