728x90
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 = 0;
sort(routes.begin(),routes.end());
int start = routes[0][0];
int end = routes[0][1];
int count =1;
for(int i=0; i<routes.size(); i++){
if(end<routes[i][0]){
count++;
end = routes[i][1];
}
if(routes[i][1]<=end){end = routes[i][1];}
}
answer = count;
return answer;
}