2022. 9. 29. 14:59 자기개발/코딩테스트
C++ (코딩테스트) - 행렬의 곱셈(프로그래머스)
문제
https://school.programmers.co.kr/learn/courses/30/lessons/12949
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
나의 풀이
#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 row = 0; row < answer.size(); row++)
for (int col = 0; col < answer[0].size(); col++)
for (int i = 0; i < arr1[0].size(); i++)
answer[row][col] += arr1[row][i] * arr2[i][col];
return answer;
}
'자기개발 > 코딩테스트' 카테고리의 다른 글
C++ (코딩테스트) - 멀리 뛰기(프로그래머스) (0) | 2022.09.30 |
---|---|
C++ (코딩테스트) - k진수에서 소수 개수 구하기(프로그래머스) (1) | 2022.09.29 |
C++ (코딩테스트) - 이진 변환 반복하기(프로그래머스) (0) | 2022.09.29 |
C++ (코딩테스트) - 신고 결과 받기(프로그래머스) (1) | 2022.09.19 |
C++ (코딩테스트) - [1차] 다트 게임(프로그래머스) (0) | 2022.09.06 |