평범한 행렬의 덧셈 문제이다.
answer의 크기를 정해놓고 풀껄 그랬다.
#include <string>
#include <vector>
using namespace std;
vector<vector<int>> solution(vector<vector<int>> arr1, vector<vector<int>> arr2) {
vector<vector<int>> answer;
for (int i = 0; i < arr1.size(); i++)
{
vector<int> temp;
for (int j = 0; j < arr1[i].size(); j++)
temp.push_back(arr1[i][j] + arr2[i][j]);
answer.push_back(temp);
}
return answer;
}'Coding_Test 연습 > Programmers' 카테고리의 다른 글
| [프로그래머스] (C++) LV1 직사각형 별찍기 (0) | 2022.04.27 |
|---|---|
| [프로그래머스] (C++) LV1 x만큼 간격이 있는 n개의 숫자 (0) | 2022.04.27 |
| [프로그래머스] (C++) LV1 핸드폰 번호 가리기 (0) | 2022.04.27 |
| [프로그래머스] (C++) LV1 하샤드 수 (0) | 2022.04.27 |
| [프로그래머스] (C++) LV1 평균 구하기 (0) | 2022.04.27 |