1
0

1582.go 374 B

12345678910111213141516171819202122232425262728
  1. package main
  2. func numSpecial(mat [][]int) int {
  3. res := 0
  4. x := make(map[int]int)
  5. y := make(map[int]int)
  6. for i, row := range mat {
  7. for j, v := range row {
  8. if v == 0 {
  9. continue
  10. }
  11. x[i]++
  12. y[j]++
  13. }
  14. }
  15. for i, row := range mat {
  16. for j, v := range row {
  17. if v == 0 {
  18. continue
  19. }
  20. if x[i] == 1 && y[j] == 1 {
  21. res++
  22. }
  23. }
  24. }
  25. return res
  26. }
备用站点 当前处于降级运行的备用站点,仅供应急访问,数据和功能可能不是最新。