Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit38d2104

Browse files
authored
Create 0452-minimum-number-of-arrows-to-burst-balloons.py
1 parent807bef4 commit38d2104

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
classSolution:
2+
deffindMinArrowShots(self,points:List[List[int]])->int:
3+
points.sort()
4+
5+
res=len(points)
6+
prev=points[0]
7+
foriinrange(1,len(points)):
8+
curr=points[i]
9+
ifcurr[0]<=prev[1]:
10+
res-=1
11+
prev= [curr[0],min(curr[1],prev[1])]
12+
else:
13+
prev=curr
14+
15+
returnres

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp