add new solutions
This commit is contained in:
parent
e1b702657c
commit
59b71480d4
11 changed files with 343 additions and 0 deletions
17
solutions/13/q1351/solution.go
Normal file
17
solutions/13/q1351/solution.go
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
package q1351
|
||||
|
||||
func countNegatives(grid [][]int) int {
|
||||
w := len(grid[0])
|
||||
count := 0
|
||||
|
||||
countRow := 0
|
||||
for r := range grid {
|
||||
for countRow < w && (grid[r][w-countRow-1] < 0) {
|
||||
countRow++
|
||||
}
|
||||
count += countRow
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
var _ = countNegatives
|
||||
Loading…
Add table
Add a link
Reference in a new issue