알고리즘

[프로그래머스] 최소직사각형

HHB 2023. 10. 9. 19:16
def solution(sizes):
    answer = 0
    msize = [0, 0]
    for i in range(len(sizes)):
        sizes[i] = sorted(sizes[i])
        if msize[0] < sizes[i][0]:
            msize[0] = sizes[i][0]
        
        if msize[1] < sizes[i][1]:
            msize[1] = sizes[i][1]
        
    return msize[0] * msize[1]
728x90
반응형
LIST