| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- machine learning
- 코딩테스트
- 딥러닝
- 컴퓨터과학과
- 캐나다 영주권
- 알고리즘
- 주정부이민
- 방통대
- 매트랩
- mpnp
- EOI
- MATLAB
- 머신러닝
- C++
- cpp
- LAA
- 프로그래머스
- 선형대수
- Plotting
- omscs
- leetcode
- zeros
- 기본
- 방송통신대학교
- LV1
- 위니펙
- Deep learning
- 조지아텍
- 개발자
- 온라인석사
Archives
- Today
- Total
Byte by Byte
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 |