[프로그래머스] lv1. 행렬의 덧셈

최대 1 분 소요

lv1. 행렬의 덧셈


Code

package programmers;

public class 행렬의덧셈 {
    public int[][] solution(int[][] arr1, int[][] arr2) {
        int row = arr1.length;
        int col = arr1[0].length;
        int[][] answer = new int[row][col];

        for(int i=0; i<row; i++){
            for(int j=0; j<col; j++){
                answer[i][j] = arr1[i][j] + arr2[i][j];
            }
        }
        return answer;
    }
}

카테고리:

업데이트:

댓글남기기