프로그래머스/Level1
프로그래머스#42(Lv.1)_최소직사각형
개발자_조이킴
2021. 10. 20. 00:35
최소직사각형
다른 분들이 하신것 보고 배우고 또 배우자! (구조분해 할당!)
포기하지말고 계속해서 공부하자!
화이팅:)
// 프로그래머스 - 최소직사각형 function solution(sizes) { let listLeft = [] let listRight = [] sizes.map((a) => a.sort((b, c) => c - b)) for(let i = 0; i < sizes.length; i++) { listLeft.push(sizes[i][0]) listRight.push(sizes[i][1]) } return Math.max(...listLeft) * Math.max(...listRight) } |
<다른분의 solution>
![]() |