티스토리 뷰
Solution in Javascript
const n = 3;
function viralAdvertising(n) {
let k = 5;
let j = 0;
let sum = 0;
for(let i = 0; i < n; i++){
j = Math.floor(k/2);
k = j * 3;
sum+=j;
}
console.log(sum);
}
viralAdvertising(n);
*Use Math.floor() to get quotient.
Reference
'Algorithms' 카테고리의 다른 글
| Invert Binary Tree (0) | 2020.11.30 |
|---|---|
| Sequence Equation (0) | 2020.10.30 |
| Angry Professor (0) | 2020.10.19 |
| Beautiful Days at the Movies (0) | 2020.10.18 |
| Migratory Birds (0) | 2020.10.01 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- hackerrank
- HackerRank Algorithm
- spring boot application
- javascript
- rest parameter
- algorithm
- hackerrank solution
- HashMap
- 프로그래머스 알고리즘문제
- substring()
- 알고리즘
- compareTo()
- Collection Framework
- equals()
- 프로그래머스
- Javascript Algorithm
- java
- repeat()
- code refactoring
- hackerrank javascript solution
- easy algorithm
- math.abs
- ... in Javascript
- easy javascript algorithm
- 프로그래머스 알고리즘
- Object type casting
- C++
- math.max
- hackerrank javascript
- string class in java
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함