Skip to content

Commit

Permalink
이슈 #414에서 솔루션 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Dec 2, 2024
1 parent a0a75b5 commit a9ce4ef
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Programmers/최소직사각형.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <vector>
#include <algorithm>

using namespace std;

int solution(vector<vector<int>> sizes) {
int maxWidth = 0;
int maxHeight = 0;

for (const auto& size : sizes) {
int w = size[0];
int h = size[1];

maxWidth = max(maxWidth, max(w, h));
maxHeight = max(maxHeight, min(w, h));
}

return maxWidth * maxHeight;
}

0 comments on commit a9ce4ef

Please sign in to comment.