Skip to content

Commit a12bf01

Browse files
committed
[PGS] 최소직사각형 / Level1 / 40분(성공)
1 parent 8739445 commit a12bf01

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
def solution(sizes):
2+
widths = []
3+
heights = []
4+
for i in range(len(sizes)):
5+
if sizes[i][0] >= sizes[i][1]:
6+
widths.append(sizes[i][0])
7+
heights.append(sizes[i][1])
8+
else:
9+
widths.append(sizes[i][1])
10+
heights.append(sizes[i][0])
11+
answer = max(widths) * max(heights)
12+
return answer
13+
'''
14+
# 다른 코드 A
15+
def solution(sizes):
16+
return max(max(x) for x in sizes) * max(min(x) for x in sizes)
17+
18+
'''
19+
20+
'''
21+
# 다른 코드 B
22+
def solution(sizes):
23+
row = 0
24+
col = 0
25+
for a, b in sizes:
26+
if a < b:
27+
a, b = b, a
28+
row = max(row, a)
29+
col = max(col, b)
30+
return row * col
31+
'''

0 commit comments

Comments
 (0)