add new solutions
This commit is contained in:
parent
d798d5e8c9
commit
886b5e0a8e
34 changed files with 1164 additions and 0 deletions
24
solutions/0/q73/solution.go
Normal file
24
solutions/0/q73/solution.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package q73
|
||||
|
||||
func setZeroes(matrix [][]int) {
|
||||
zRows := make([]bool, len(matrix))
|
||||
zCols := make([]bool, len(matrix[0]))
|
||||
for r := range matrix {
|
||||
for c := range matrix[0] {
|
||||
if matrix[r][c] == 0 {
|
||||
zRows[r] = true
|
||||
zCols[c] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for r := range matrix {
|
||||
for c := range matrix[0] {
|
||||
if zRows[r] || zCols[c] {
|
||||
matrix[r][c] = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _ = setZeroes
|
||||
Loading…
Add table
Add a link
Reference in a new issue