Programmers 86491
최소직사각형


CODE ⌨️

#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int solution(vector<vector<int>> sizes)
{
    int answer = 0;
    
    int maxw = 0;
    int maxh = 0;
    
    for (int i = 0; i < sizes.size(); i++)
    {
        int w, h;
        
        if (sizes[i][0] < sizes[i][1])
        {
            w = sizes[i][1];
            h = sizes[i][0];
        }
        else
        {
            w = sizes[i][0];
            h = sizes[i][1];
        }
        
        maxw = max(maxw, w);
        maxh = max(maxh, h);
    }
    
    answer = maxw * maxh;
    
    return answer;
}



RESULT 💛



SIMPLE DISCUSSION ✏️

완전탐색 관련 쉬운 문제였다.



SOURCE 💎

Programmers_Link 👈 Click here


*****
NOT A TALENT ❎ NOT GIVING UP ✅
CopyRight ⓒ 2022 DCherish All Rights Reserved.