Skip to content

Commit 2c5fac8

Browse files
committed
matrix_addition /중급
1 parent d762df2 commit 2c5fac8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
function solution(arr1, arr2) {
2+
var answer = [];
3+
for (let i = 0; i < arr1.length; i++) {
4+
let minarr = [];
5+
for (let j = 0; j < arr1[i].length; j++) {
6+
minarr.push(arr1[i][j] + arr2[i][j]);
7+
}
8+
answer.push(minarr);
9+
}
10+
return answer;
11+
}
12+
console.log(
13+
solution(
14+
[
15+
[1, 2],
16+
[2, 3],
17+
],
18+
[
19+
[3, 4],
20+
[5, 6],
21+
]
22+
)
23+
);

0 commit comments

Comments
 (0)