단속카메라

#include <bits/stdc++.h>
using namespace std;
 
int solution(vector<vector<int>> routes) 
{
    // 1. 차량 경로를 나가는 지점 기준으로 오름차순 정렬
    sort(routes.begin(), routes.end(), [](const vector<int>& a, const vector<int>& b) 
    {
        return a[1] < b[1]; //a의 나가는 지점이 b의 나가는 지점보다 작으면 a가 앞에 오도록 정렬
    });
 
    int answer = 0;            // 설치한 카메라 수
    int camera = -30001;       // 마지막으로 설치한 카메라 위치. 초기값은 최소 진입 지점보다 작게 설정
 
    // 2. 차량 경로 순회하면서 카메라 설치 위치 결정
    for (int i = 0; i < routes.size(); i++) 
    {
        vector<int>& route = routes[i];      //routes의 vector<int>들을 하나씩 route에 넣음
        if(route[0] > camera)
        {
            camera = route[1];
            answer++;
        }
    }
 
    return answer;
}