Skip to content

Instantly share code, notes, and snippets.

@emayom
Created August 20, 2021 03:13
Show Gist options
  • Save emayom/c3d36d7c597fb5bdd94ef6f9e8a5af40 to your computer and use it in GitHub Desktop.
Save emayom/c3d36d7c597fb5bdd94ef6f9e8a5af40 to your computer and use it in GitHub Desktop.
[프로그래머스] 행렬의 곱셈
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