https://school.programmers.co.kr/learn/courses/30/lessons/12949
๋ด ์ฝ๋
ํ๋ ฌ ์ฐ์ฐ์ ๊ตฌํํ๋ฉด ๋๋ค.
ํ๋ ฌ ์ฐ์ฐ ๋ฐฉ๋ฒ์ ์ฝ๋๋ก ์ฎ๊ธฐ๋ ๊ฒ ์กฐ๊ธ ๋จธ๋ฆฌ ์ํ ๋ค.
#include <string>
#include <vector>
using namespace std;
vector<vector<int>> solution(vector<vector<int>> arr1, vector<vector<int>> arr2) {
vector<vector<int>> answer(arr1.size(), vector<int>(arr2[0].size(), 0));
for(int m = 0; m < answer.size(); ++m)
for(int n = 0; n < answer[0].size(); ++n)
for(int i = 0; i < arr1[0].size(); ++i)
answer[m][n] += arr1[m][i] * arr2[i][n];
return answer;
}
'๐ฅ๏ธ Study Note > Coding Test' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค]level.2 - ์์ ๋์งํ(C++) (0) | 2023.06.28 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค]level.2 - ๊ด๋ฌผ ์บ๊ธฐ(C++) (0) | 2023.06.26 |
[ํ๋ก๊ทธ๋๋จธ์ค]level.3 - ๋ฉ๋ฆฌ ๋ฐ๊ธฐ(C++) (0) | 2023.06.23 |
[ํ๋ก๊ทธ๋๋จธ์ค]level.3 - ์๋ฌผ์ ์ ์ด์ (C++) (0) | 2023.06.21 |
[ํ๋ก๊ทธ๋๋จธ์ค]level.1 - ํ์ค๋ ์(C++) (0) | 2023.06.20 |