https://programmers.co.kr/learn/courses/30/lessons/82612?language=javascript
function solution(price, money, count) {
var answer = 0, sum = 0;
for (let i = 1; i <= count; i++) {
sum += price * i;
}
if (sum > money) {
answer = sum - money;
}
return answer;
}
'알고리즘 > 프로그래머스' 카테고리의 다른 글
[프로그래머스][자바스크립트][Level1][카카오] 숫자 문자열과 영단어 (0) | 2022.01.02 |
---|---|
[프로그래머스][자바스크립트][Level1] 로또의 최고 순위와 최저 순위 (0) | 2022.01.01 |
[프로그래머스][자바스크립트][Level2][카카오] 오픈채팅방 (0) | 2021.07.22 |
[프로그래머스][자바스크립트][Level2][카카오] 문자열 압축 (0) | 2021.07.22 |
[프로그래머스][자바스크립트][Level2] 124 나라의 숫자 (0) | 2021.07.21 |
댓글