(프로그래머스) 최소직사각형

유지원·2022년 4월 6일
0

프로그래머스

목록 보기
21/66

문제 링크

https://programmers.co.kr/learn/courses/30/lessons/86491?language=javascript


Javascript

function solution(sizes) {
    const [hor, ver] = sizes.reduce(([h, v], [a, b]) => [Math.max(h, Math.max(a, b)), Math.max(v, Math.min(a, b))], [0, 0])
    return hor * ver;
}
profile
👋 https://github.com/ujw0712

0개의 댓글