[C++] 프로그래머스 '최소직사각형' 풀이

#include <string>
#include <vector>

using namespace std;

int solution(vector<vector<int>> sizes) {
    int answer = 0;
    int max_x=0; //가장 큰 
    int max_y=0; //두번째로 큰 
    
    for(auto c:sizes){
        //항상 큰,작은 순으로 두기 
        if(c[0]<c[1]){
            swap(c[0],c[1]);
        }
        
        if(max_x<c[0]) max_x=c[0];
        if(max_y<c[1]) max_y=c[1];
    }
    
    answer=max_x*max_y;
    return answer;
}