프로그래머스 12950 행렬의 덧셈

1 개요[ | ]

프로그래머스 12950 행렬의 덧셈

2 C++[ | ]

#include <string>
#include <vector>

using namespace std;

vector<vector<int>> solution(vector<vector<int>> arr1, vector<vector<int>> arr2) {
    int rowSize = arr1.size();
    int colSize = arr1[0].size(); 
    vector<vector<int>> answer(rowSize, vector<int>(colSize, 0));
    for(int i=0; i<rowSize; i++) {
        for(int j=0; j<colSize; j++) {
            answer[i][j] = arr1[i][j] + arr2[i][j];
        }
    }
    return answer;
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}