728x90
반응형
문제 출처: https://school.programmers.co.kr/learn/courses/30/lessons/12949
풀이:
import numpy as np
def solution(arr1, arr2):
return np.dot(arr1,arr2).tolist()
# numpy 활용한 쉬운 풀이
def solution(arr1, arr2):
list = [len(arr2[0]) * [0] for i in range(len(arr1))]
for i in range(len(arr1)): # 행
for j in range(len(arr2[0])): # 열
for k in range(len(arr1[0])): # 행 돌면서 열이랑 곱함
list[i][j] += arr1[i][k] * arr2[k][j]
return list
반응형
댓글