mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2026-02-02 18:39:09 +08:00
Update
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user