일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 | 31 |
Tags
- machine learning
- 온라인석사
- mpnp
- 딥러닝
- leetcode
- 알고리즘
- 기본
- 코딩테스트
- 캐나다 영주권
- cpp
- LAA
- 조지아텍
- Deep learning
- LV1
- 컴퓨터과학과
- Plotting
- C++
- 매트랩
- 선형대수
- 방송통신대학교
- zeros
- 주정부이민
- EOI
- 머신러닝
- 방통대
- 개발자
- omscs
- MATLAB
- 프로그래머스
- 마니토바
Archives
- Today
- Total
Krononberg
1252. Cells with Odd Values in a Matrix.cpp 본문
class Solution {
public:
int oddCells(int m, int n, vector<vector<int>>& indices) {
vector<int>x(n,0);
vector<vector<int>>mat(m,x);
for(int x=0; x<indices.size();x++){
for(int i =0;i <m;++i){
for(int j =0; j<n;++j){
if(i==indices[x][0]) mat[i][j]++;
if(j==indices[x][1]) mat[i][j]++;
}
}
}
int cnt=0;
for(int i =0;i <m;++i){
for(int j =0; j<n;++j){
if(mat[i][j]%2==1)
cnt++;
}
}
return cnt;
}
};
'개발 로그 > 알고리즘' 카테고리의 다른 글
763. Partition Labels.cpp (0) | 2021.10.03 |
---|---|
1605. Find Valid Matrix Given Row and Column Sums.cpp (0) | 2021.10.03 |
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 |
1008. Construct Binary Search Tree from Preorder Traversal.cpp (0) | 2021.10.02 |