diff --git a/leetcode/leetcode75/2352.EqualRowAndColumnPairs/equalRowAndColumnPairs.go b/leetcode/leetcode75/2352.EqualRowAndColumnPairs/equalRowAndColumnPairs.go new file mode 100644 index 0000000..70692f7 --- /dev/null +++ b/leetcode/leetcode75/2352.EqualRowAndColumnPairs/equalRowAndColumnPairs.go @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" +) + +func equalPairs(grid [][]int) int { + result := 0 + for i := range grid { + for j := range grid { + ok := 1 + for k := range grid { + if grid[i][k] != grid[k][j] { + ok = 0 + break + } + } + result += ok + } + } + return result +} + +func main() { + grid := [][]int{{3, 1, 2, 2}, {1, 4, 4, 5}, {2, 4, 2, 2}, {2, 4, 2, 2}} + fmt.Print(equalPairs(grid)) +}