Created
August 20, 2021 03:13
-
-
Save emayom/c3d36d7c597fb5bdd94ef6f9e8a5af40 to your computer and use it in GitHub Desktop.
[프로그래머스] 행렬의 곱셈
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function solution(arr1, arr2) { | |
const m = arr1.length; | |
const k = arr1[0].length; | |
const n = arr2[0].length; | |
let answer = []; | |
for(let i = 0; i < m; i++){ | |
let temp = []; | |
for(let j = 0; j < n; j++){ | |
let x = 0; | |
for(let n = 0; n < k; n++){ | |
x += arr1[i][n] * arr2[n][j]; | |
} | |
temp.push(x); | |
} | |
answer.push(temp); | |
} | |
return answer; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment