솔루션
function solution(sides) {
const min = Math.min(...sides);
const max1 = Math.max(...sides);
const max2 = min + max1 - 1;
return max2 - (max1 - min);
}
솔루션
function solution(sides) {
return Math.min(...sides) * 2 - 1;
}
'프로그래머스(Javascript) > Level 0' 카테고리의 다른 글
[프로그래머스 | 자바스크립트] 숨어있는 숫자의 덧셈(2) (0) | 2023.04.16 |
---|---|
[프로그래머스 | 자바스크립트] 안전지대 (0) | 2023.04.16 |
[프로그래머스 | 자바스크립트] 외계어 사전 (0) | 2023.03.03 |
[프로그래머스 | 자바스크립트] 저주의 숫자 3 (0) | 2023.03.03 |
[프로그래머스 | 자바스크립트] 평행 (0) | 2023.03.03 |