| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 딥러닝
- 알고리즘
- cpp
- 방통대
- MATLAB
- 매트랩
- 주정부이민
- 조지아텍
- zeros
- 코딩테스트
- 컴퓨터과학과
- leetcode
- Deep learning
- 개발자
- EOI
- mpnp
- 방송통신대학교
- C++
- 프로그래머스
- 위니펙
- 선형대수
- omscs
- 기본
- LAA
- 온라인석사
- Plotting
- machine learning
- LV1
- 캐나다 영주권
- 머신러닝
Archives
- Today
- Total
Byte by Byte
1605. Find Valid Matrix Given Row and Column Sums.cpp 본문
class Solution {
public:
vector<vector<int>> restoreMatrix(vector<int>& rowSum, vector<int>& colSum) {
int m = rowSum.size();
int n = colSum.size();
vector<vector<int>>res(m,vector<int>(n));
for(int i =0; i< m; i++){
for(int j =0; j<n; j++){
res[i][j] = min(rowSum[i],colSum[j]);
rowSum[i] -= res[i][j];
colSum[j] -= res[i][j];
}
}
return res;
}
};'개발 로그 > 알고리즘' 카테고리의 다른 글
| 1382. Balance a Binary Search Tree.cpp (0) | 2021.10.04 |
|---|---|
| 763. Partition Labels.cpp (0) | 2021.10.03 |
| 1252. Cells with Odd Values in a Matrix.cpp (0) | 2021.10.02 |
| 1725. Number Of Rectangles That Can Form The Largest Square.cpp (0) | 2021.10.02 |
| 894. All Possible Full Binary Trees.cpp (0) | 2021.10.02 |