최적해를 구하는 데에 사용되는 근사적인 방법으로, 현재를 기준으로 가장 최적의 상황을 골라가며 해답을 찾는 알고리즘이다.
대표적인 문제로는 회의실 배정 문제가 있다. (백준 1931)
https://www.acmicpc.net/problem/1931

import sys
input = sys.stdin.readline
n = int(input())
times = []
for _ in range(n):
times.append(list(map(int, input().split())))
times.sort(key = lambda x : (x[1], x[0]))
now_time = 0
cnt = 0
for t in times:
if t[0] >= now_time:
now_time = t[1]
cnt += 1
print(cnt)
times.sort(key = lambda x : (x[1], x[0]))