Advertisement
Syldarion

Untitled

Oct 15th, 2021
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. columns = []
  2. matrix = [][]
  3.  
  4. for (i = 0; i < m; i++)
  5. # i for rows
  6. setting_zeroes = false
  7. for (j = 0; j < n; j++)
  8. # j for columns
  9. if setting_zeroes:
  10. matrix[i][j] = 0
  11. continue
  12. if matrix[i][j] == 0:
  13. columns.append(j)
  14. j = -1
  15. setting_zeroes = true
  16.  
  17. foreach (int j in columns) {
  18. for (i = 0; i < m; i++) {
  19. matrix[i][j] = 0
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement