Skip to content

Commit 58245c2

Browse files
committed
행렬의 덧셈 / 중급
1 parent 7c2335d commit 58245c2

File tree

1 file changed

+19
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)