행렬의 덧셈

han.user();·2023년 4월 16일
0

프로그래머스

목록 보기
77/87
post-thumbnail

import java.util.Arrays;

class Solution {
    public int[][] solution(int[][] arr1, int[][] arr2) {
        int[][] answer = new int[arr1.length][arr1[0].length];

        for (int i = 0; i < arr1.length; i++) {
            for (int j = 0; j < arr1[0].length; j++) {
                answer[i][j] = arr1[i][j] + arr2[i][j];
            }
        }
        return answer;
    }
}
profile
I'm still hungry.

0개의 댓글