Description
Submission
class Solution { public: void setZeroes(vector<vector<int>>& matrix) { queue<vector<int>> q; int nRow = matrix.size(); int nCol = matrix[0].size(); for(int i = 0; i < nRow; ++i) { for(int j = 0; j < nCol; ++j) { if(matrix[i][j] == 0) q.push({i, j}); } } while(!q.empty()) { int x = q.front()[0]; int y = q.front()[1]; for(int i = 0; i < nCol; ++i) { matrix[x][i] = 0; } for(int j = 0; j < nRow; ++j) { matrix[j][y] = 0; } q.pop(); } } };