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
}
'알고리즘문풀 with SWIFT > Programmers' 카테고리의 다른 글
swift ) 프로그래머스 - 하샤드 수 (0) | 2022.05.23 |
---|---|
swift ) 프로그래머스 - 핸드폰 번호 가리기 (0) | 2022.05.23 |
swift ) 프로그래머스 - x만큼 간격이 있는 n개의 숫자 (0) | 2022.05.23 |
swift ) 프로그래머스 - 직사각형 별찍기 (0) | 2022.05.23 |
swift ) 프로그래머스 - 모의고사 (수포자) (0) | 2022.05.07 |