Published:
Updated:

https://programmers.co.kr/learn/courses/30/lessons/12950


Solution

import java.util.Arrays;

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

        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;
    }
}

Leave a comment