Skip to content

Commit

Permalink
알고리즘
Browse files Browse the repository at this point in the history
  • Loading branch information
sunyeongchoi committed Mar 30, 2021
1 parent 45f35eb commit 288dc89
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions argorithm/1931.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

n = int(input())
arr = [list(map(int, input().split())) for _ in range(n)]
arr = sorted(arr, key=lambda x: (x[1], x[0]))

for a in arr:
start, end = a

answer = 1
end = arr[0][1]
for i in range(1, n):
if arr[i][0] >= end:
end = arr[i][1]
answer += 1
print(answer)

0 comments on commit 288dc89

Please sign in to comment.