-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution.h
More file actions
46 lines (43 loc) · 1.03 KB
/
Solution.h
File metadata and controls
46 lines (43 loc) · 1.03 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <bits/stdc++.h>
using namespace std;
// class Solution {
// public:
// void setZeroes (vector<vector<int>>& matrix) {
// vector<bool> recordR(matrix.size(), false);
// vector<bool> recordC(matrix[0].size(), false);
// for (int i = 0; i < matrix.size(); ++i) {
// for (int j = 0; j < matrix[i].size(); ++j) {
// if (matrix[i][j] == 0)
// recordC[j] = recordR[i] = true;
// }
// }
// }
//
// void fill (vector<vector<int>>& matrix, int row, int column) {
// if (row >= 0 && row < matrix.size()) {
// for (int i = 0; i < matrix[row].size(); ++i)
// matrix[row][i] = 0;
// }
//
// if (column >= 0 && column < matrix[0].size()) {
// for (int i = 0; i < matrix.size(); ++i)
// matrix[i][column] = 0;
// }
//
// }
// };
class Solution {
public:
int hammingWeight(uint32_t n) {
int res = 0;
while(n) {
n = n & (n - 1);
res++;
}
cout << "hello world" << endl;
cout << "C++" << endl;
cout << "changes 1" << endl;
cout << "changes 3" << endl;
return res;
}
};