BFS를 활용한 풀이이다.
def solution(sizes):
shorter, longer = [], []
for i in range(len(sizes)):
shorter.append(min(sizes[i]))
longer.append(max(sizes[i]))
return max(shorter) * max(longer)
논리는 똑같지만, List comprehension을 통해 코드를 훨씬 단순화한 풀이이다.
def solution(sizes):
return max(max(x) for x in sizes) * max(min(x) for x in sizes)