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
+32
View File
@@ -0,0 +1,32 @@
class Solution{
public:
int numSpecial(vector<vector<int>> &mat){
int ans = 0;
int r = mat.size();
int c = mat[0].size();
for(int row=0;row<r;row++){
for(int col = 0;col<c;col++){
if(mat[row][col]==0) continue;
bool good = true;
for(int m = 0;m<r;m++){
if(m!=row && mat[m][col] == 1){
good = false;
break;
}
}
for(int n = 0;n<c;n++){
if(n!=col && mat[row][n] == 1){
good = false;
break;
}
}
if(good) ans++;
}
}
return ans;
}
};
//TC : o(r.c(r+c)) SC: o(1)