add codeforces solutions folder

This commit is contained in:
2026-03-05 19:55:52 +05:30
parent 77ff815f38
commit e698c35654
20 changed files with 778 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
class Solution {
public:
int numSpecial(vector<vector<int>>& mat) {
int m = mat.size();
int n = mat[0].size();
vector<int> rowCount(m, 0);
vector<int> colCount(n, 0);
for (int row = 0; row < m; row++) {
for (int col = 0; col < n; col++) {
if (mat[row][col] == 1) {
rowCount[row]++;
colCount[col]++;
}
}
}
int ans = 0;
for (int row = 0; row < m; row++) {
for (int col = 0; col < n; col++) {
if (mat[row][col] == 1) {
if (rowCount[row] == 1 && colCount[col] == 1) {
ans++;
}
}
}
}
return ans;
}
};