본문 바로가기

Algorithms

Programers-7_행렬의 덧셈

 

내 코드:

public class Solution {
    public int[,] solution(int[,] arr1, int[,] arr2) {
        int[,] answer = new int[arr1.GetLength(0), arr1.GetLength(1)];
        for(int i = 0; i < answer.GetLength(0); i++){
            for(int j = 0; j < answer.GetLength(1); j++){
                answer[i,j] = arr1[i,j] + arr2[i,j];
            }
        }
        return answer;
    }
}

 

'Algorithms' 카테고리의 다른 글

근삿값 알고리즘  (0) 2022.09.01
별찍기  (0) 2022.05.09
Programers - 6 _ 콜라츠 추측  (0) 2022.05.02
Programers - 5 _ 평균 구하기  (0) 2022.05.02
Programers - 4 _ 하샤드 수  (0) 2022.05.02