| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |
Tags
- 링피트
- English
- 화상영어
- 프로젝트
- 30분
- Writing
- 영어원서읽기
- 잡생각
- Daily Challenge
- leetcode
- 미드시청
- 만화도
- 스탭퍼
- realclass
- 뭐든
- 읽기
- 영어공부
- 운동
- 개발자
- 쓰릴오브파이트
- 월간
- 사이드
- FIT XR
- 10분
- 리얼 클래스
- Problem Solving
- 매일
- 파비최
- 3줄정리
- 괜찮음
Archives
- Today
- Total
파비의 매일매일 공부기록
Today's Challenge 본문
https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/
Minimum Number of Arrows to Burst Balloons - LeetCode
Minimum Number of Arrows to Burst Balloons - There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array points where points[i] = [xstart, xend] denotes a balloon whose horizonta
leetcode.com
어제에 이은 탐욕법으로 풀기
뒤에서 부터 순회하면서 세면 됨
class Solution:
def findMinArrowShots(self, points: List[List[int]]) -> int:
points.sort()
res, cur_start = 1, points[-1][0]
for s, e in reversed(points):
if e < cur_start:
cur_start = s
res += 1
return res반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
| Today's Challenge (0) | 2023.01.07 |
|---|---|
| Today's Challenge (0) | 2023.01.06 |
| Today's Challenge (0) | 2023.01.04 |
| Today's Challenge (0) | 2023.01.03 |
| Today's Challenge (0) | 2023.01.02 |
Comments