프로그래머스 86491 최소직사각형

1 개요[ | ]

프로그래머스 86491 최소직사각형

2 C++[ | ]

#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int solution(vector<vector<int>> sizes) {
    int maxW = 0;
    int maxH = 0;
    for(const auto& size: sizes) {
        int w = max(size[0], size[1]);
        int h = min(size[0], size[1]);
        if(w > maxW) maxW = w;
        if(h > maxH) maxH = h;
    }
    return maxW * maxH;
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}