Skip to content

Commit ae19d94

Browse files
committed
solve: week29 문제 해결
1 parent ef98b92 commit ae19d94

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function solution(n) {
2+
let num = 1;
3+
const answer = [];
4+
while (num <= n) {
5+
if (n % num === 0) {
6+
answer.push(num);
7+
}
8+
num += 1;
9+
}
10+
return answer;
11+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function solution(array) {
2+
const answer = [];
3+
answer.push(Math.max(...array));
4+
answer.push(array.indexOf(answer[0]));
5+
return answer;
6+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
function solution(arr) {
2+
let answer = arr.reduce((acc, cur) => acc + cur, 0);
3+
return answer / arr.length;
4+
}

0 commit comments

Comments
 (0)