Skip to content

Commit 8848a76

Browse files
authored
Merge pull request #188 from zzzyoonnn/main
[Solved] PRG_최소직사각형
2 parents 37c6d16 + 7538cec commit 8848a76

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package Week4.공통.최소직사각형;
2+
3+
public class jiyoon {
4+
class Solution {
5+
public int solution(int[][] sizes) {
6+
int max_width = 0;
7+
int max_height = 0;
8+
9+
for (int i = 0; i < sizes.length; i++) {
10+
int width = Math.min(sizes[i][0], sizes[i][1]); // 너비를 명함의 최솟값으로 설정
11+
int height = Math.max(sizes[i][0], sizes[i][1]); // 높이를 명함의 최댓값으로 설정
12+
max_width = Math.max(max_width, width);
13+
max_height = Math.max(max_height, height);
14+
}
15+
16+
return max_width * max_height;
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)