Skip to content

Commit 0bf2154

Browse files
committed
Matrix addition / 중급
1 parent 437e305 commit 0bf2154

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

tkddbs587/Array/Matrix_addition.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function solution(arr1, arr2) {
2+
let answer = [];
3+
4+
for (let i = 0; i < arr1.length; i++) {
5+
let newRow = [];
6+
7+
for (let j = 0; j < arr1[i].length; j++) {
8+
newRow.push(arr1[i][j] + arr2[i][j]);
9+
}
10+
answer.push(newRow);
11+
}
12+
13+
return answer;
14+
}

tkddbs587/Array/duplicate_count.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function solution(array, n) {
2+
return array.filter((el) => el === n).length;
3+
}

0 commit comments

Comments
 (0)