문제
https://school.programmers.co.kr/learn/courses/30/lessons/12949
접근 방법 및 풀이
일반적인 행렬의 곱셈을 그대로 구현
public class Q30_12949 {
public int[][] solution(int[][] arr1, int[][] arr2) {
int xLength = arr1.length;
int yLength = arr2[0].length;
int zLength = arr2.length;
int[][] answer = new int[xLength][yLength];
for (int i = 0; i < xLength; i++) {
for (int j = 0; j < yLength; j++) {
int temp = 0;
for (int k = 0; k < zLength; k++) {
temp += arr1[i][k] * arr2[k][j];
}
answer[i][j] = temp;
}
}
return answer;
}
}