Skip to content

Commit

Permalink
삼각형의 완성조건 (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
dudwns committed May 22, 2023
1 parent 992e3b3 commit 775ba9c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Programmers/exam79.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function solution(sides) {
let answer = 0;
let max = Math.max(...sides);
let min = Math.min(...sides);
for (let i = 1; i <= max; i++) {
if (i + min > max) {
answer++;
}
}
for (let i = max + 1; i < max + min; i++) {
answer++;
}
return answer;
}

0 comments on commit 775ba9c

Please sign in to comment.