Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- python sorted
- 알고리즘풀이
- leetcode 풀기
- 릿코드 풀기
- 파이썬알고리즘풀기
- leetcode풀이
- 파이썬 알고리즘 풀기
- 파이썬 알고리즘
- 파이썬 릿코드
- LeetCode
- python 알고리즘
- 파이썬릿코드
- python priority queue
- leetcode풀기
- 파이썬릿코드풀기
- 릿코드
- python 릿코드
- 알고리즘풀기
- 릿코드 파이썬
- 릿코드풀이
- python xor
- 상가수익률계산기
- 코틀린기초
- 릿코드풀기
- 파이썬알고리즘
- 파이썬 프로그래머스
- python zip_longest
- binary search
- 잇츠디모
- python Leetcode
Archives
- Today
- Total
소프트웨어에 대한 모든 것
LeetCode 풀기 - 1288. Remove Covered Intervals 본문
반응형
1288. Remove Covered Intervals
https://leetcode.com/problems/remove-covered-intervals/
Remove Covered Intervals - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
문제)
솔루션1)
class Solution:
def removeCoveredIntervals(self, nums: List[List[int]]) -> int:
count = len(nums)
# 오름차순 정렬
nums = sorted(nums, key=lambda x: x[0])
target_num = nums[0]
target_idx = 0
for i, num in enumerate(nums[1:]):
if num[1] <= target_num[1]:
count -= 1
else:
if num[0] == target_num[0]:
count -= 1
target_idx = i
target_num = num
return count
반응형
'알고리즘 > LeetCode' 카테고리의 다른 글
LeetCode 풀기 - 171. Excel Sheet Column Number (0) | 2022.02.22 |
---|---|
LeetCode 풀기 - 169. Majority Element (0) | 2022.02.22 |
LeetCode 풀기 - 104. Maximum Depth of Binary Tree (0) | 2022.02.15 |
LeetCode 풀기 - 389. Find the Difference (0) | 2022.02.09 |
LeetCode 풀기 - 532. K-diff Pairs in an Array (0) | 2022.02.09 |
Comments