알고리즘문풀 with SWIFT/Programmers

swift ) 프로그래머스 - 행렬의 덧셈

유사앱등이 2022. 5. 23. 02:50
func solution(_ arr1:[[Int]], _ arr2:[[Int]]) -> [[Int]] {
	var arr : [[Int]] = Array(repeating:Array(repeating:0, count:arr1[0].count), count:arr1.count)

	for i in 0..<arr1.count {
		for j in 0..<arr1[0].count {
			arr[i][j] = arr1[i][j] + arr2[i][j]
		}
	}
	return arr
}