https://school.programmers.co.kr/learn/courses/30/lessons/12949
def solution(arr1, arr2):
answer = [[] for _ in range(len(arr1))]
# arr1의 행, arr2의 열, arr1의 열에 대해 반복하여 행렬 곱셈 수행
for i in range(len(arr1)):
for j in range(len(arr2[0])):
result = 0
for k in range(len(arr1[0])):
result += arr1[i][k] * arr2[k][j]
answer[i].append(result)
return answer
def solution(arr1, arr2):
m, n, r = len(arr1), len(arr1[0]), len(arr2[0])
answer = [[0 for _ in range(r)] for _ in range(m)] # m * r 크기의 행렬
for i in range(m):
for k in range(r):
for j in range(n):
answer[i][k] += arr1[i][j] * arr2[j][k]
return answer