-
[위클리챌린지] 8주차 최소직사각형(JavaScript)🧠𝗔𝗹𝗴𝗼𝗿𝗶𝘁𝗵𝗺/💙프로그래머스 2021. 9. 29. 11:00
문제
https://programmers.co.kr/learn/courses/30/lessons/86491
풀이
function solution(sizes) { let answer = 0; // 두 변중 긴 것 -> 가로 // 두 변중 짧은 것 -> 세로 let width = 0; let height = 0; for (let i = 0; i < sizes.length; i++) { width = Math.max(width, Math.max(sizes[i][0], sizes[i][1])); height = Math.max(height, Math.min(sizes[i][0], sizes[i][1])); } answer = width * height; return answer; }
'🧠𝗔𝗹𝗴𝗼𝗿𝗶𝘁𝗵𝗺 > 💙프로그래머스' 카테고리의 다른 글
[SQL] 프로그래머스 2단계 SQL문제 모음 (0) 2021.11.05 [SQL] 프로그래머스 1단계 SQL문제 모음 (0) 2021.11.05 [코딩테스트 고득점 Kit / Level2 🧒🏻 / 스택/큐] 프린터(python) (0) 2021.07.08 [Summer/Winter Coding(~2018)/Level1👶🏻] 예산 (0) 2021.07.06 [찾아라 프로그래밍 마에스터 / Level1👶🏻] 폰켓몬 (0) 2021.06.30