From 035120f9316ae3d0abd9e16130e17360886987f6 Mon Sep 17 00:00:00 2001 From: wolves Date: Wed, 4 Mar 2026 17:45:45 +0800 Subject: [PATCH] routine --- 26/03/1582.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 26/03/1582.go diff --git a/26/03/1582.go b/26/03/1582.go new file mode 100644 index 0000000..b779f5d --- /dev/null +++ b/26/03/1582.go @@ -0,0 +1,28 @@ +package A + +func numSpecial(mat [][]int) int { + res := 0 + x := make(map[int]int) + y := make(map[int]int) + for i, row := range mat { + for j, v := range row { + if v == 0 { + continue + } + x[i]++ + y[j]++ + } + } + for i, row := range mat { + for j, v := range row { + if v == 0 { + continue + } + if x[i] == 1 && y[j] == 1 { + res++ + } + + } + } + return res +}