https://programmers.co.kr/learn/courses/30/lessons/42884
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<vector<int>> routes) {
int answer = 1;
sort(routes.begin(), routes.end());
int out = routes[0][1];
for(int i=1;i<routes.size();i++){
if(routes[i][0] <= out)
out = min(routes[i][1], out);
else{
answer++;
out = routes[i][1];
}
}
return answer;
}
#include <bits/stdc++.h>
using namespace std;
bool cmp(vector<int> a, vector<int> b) { return a[1] < b[1]; }
int solution(vector<vector<int>> routes) {
int answer = 0;
int limit = -30001;
sort(routes.begin(), routes.end(), cmp);
for(int i = 0; i < routes.size(); i++){
if(limit < routes[i][0]){
answer++;
limit = routes[i][1];
}
}
return answer;
}