728x90
반응형
문제 출처: https://school.programmers.co.kr/learn/courses/30/lessons/12950
풀이:
def solution(arr1, arr2):
answer = []
for i in range(len(arr1)):
list=[]
for j in range(len(arr1[i])):
list.append(arr1[i][j]+arr2[i][j])
answer.append(list)
return answer
numpy 로도 풀 수 있다.
import numpy as np
def solution(arr1, arr2):
arr1 = np.array(arr1)
arr2 = np.array(arr2)
answer = arr1 + arr2
return solution.tolist()
반응형
댓글