Skip to content

Commit 8f33c3f

Browse files
committed
행렬의 곱셉 / 심화
1 parent 35ac806 commit 8f33c3f

File tree

1 file changed

+16
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)