Skip to content

Commit

Permalink
Time: 63 ms (9.29%), Space: 13.1 MB (84.39%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
Dipendra-Raghav committed Jul 1, 2023
1 parent 0db7e05 commit eaa7214
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions 0073-set-matrix-zeroes/0073-set-matrix-zeroes.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
class Solution {
public:
void setZeroes(vector<vector<int>>& matrix) {
int m=matrix.size();

int n=matrix[0].size();
vector<int> row(n,INT_MIN);
vector<int> col(m,INT_MIN);
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
if(matrix[i][j]==0)
{
row[j]=0;
col[i]=0;
}
}
}
for(int i=0;i<n;i++)cout<<row[i]<<" ";
cout<<endl;
for(int i=0;i<m;i++)cout<<col[i]<<" ";


for(int i=0;i<n;i++)
{
if(row[i]==0){
cout<<i;
for(int j=0;j<m;j++)
{
cout<<"hi"<<i<<j;
matrix[j][i]=0;
cout<<"*"<<" ";
}
}
}
cout<<" hi2135"<<" ";
for(int i=0;i<m;i++)
{
if(col[i]==0){
for(int j=0;j<n;j++)
{
matrix[i][j]=0;
}
}
}


}
};

0 comments on commit eaa7214

Please sign in to comment.