๋ฐ์ํ
https://school.programmers.co.kr/learn/courses/30/lessons/12949
function solution(arr1, arr2) {
let row = arr1.length;
let col = arr2[0].length;
let com = arr1[0].length;
// ๋ต๋ฐฐ์ด ์ด๊ธฐํ
let ans = [];
for(let i=0; i<row; i++) {
let tmp = [];
for (let j=0; j<col; j++) {
tmp.push(0);
}
ans.push(tmp);
}
// ์ฐ์ฐ
for(let i=0; i<row; i++) {
for(let j=0; j<col; j++) {
for(let k=0; k<com; k++) {
ans[i][j] += arr1[i][k] * arr2[k][j];
}
}
}
return ans;
}
๋ฐ์ํ
'๐ ๋ญ? JS๋ก PS๋ฅผ ํ๋ค๊ณ ?' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค][JS / Javascript] ๋ ๋ฐ๋จน๊ธฐ (0) | 2023.07.06 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค][JS / Javascript] ์์ ์ฐพ๊ธฐ (0) | 2023.06.20 |
[ํ๋ก๊ทธ๋๋จธ์ค][JS / Javascript] ํ๋ฐฐ ๋ฐฐ๋ฌ๊ณผ ์๊ฑฐํ๊ธฐ (0) | 2023.06.06 |
[ํ๋ก๊ทธ๋๋จธ์ค][JS / Javascript] ์ฃผ์ฐจ ์๊ธ ๊ณ์ฐ (0) | 2023.06.05 |
[ํ๋ก๊ทธ๋๋จธ์ค][JS / Javascript] [3์ฐจ] n์ง์ ๊ฒ์ (0) | 2023.05.31 |