func findMissingAndRepeatedValues(grid [][]int) []int { n := len(grid) countMap := make([]int, n*n+1) for i := 0; i < n; i++ { for j := 0; j < n; j++ { countMap[grid[i][j]]++ } } zero := 0 two := 0 for i := 1; i <= n*n; i++ { if countMap[i] == 0 { zero = i } else if countMap[i] == 2 { two = i } } return []int{two, zero} }