Golang BFS Solution
Complexity

Time complexity:
O(N ^ 2)


Space complexity:
O(N ^ 2)

Code
# Complexity
- Time complexity:
O(N ^ 2)

- Space complexity:
O(N ^ 2)

# Code
```golang []
func highestPeak(isWater [][]int) [][]int {
	res := make([][]int, 0)
	queue := [][2]int{}

	for i := 0; i < len(isWater); i++ {
		res = append(res, make([]int, len(isWater[0])))

		for j := 0; j < len(isWater[0]); j++ {
			if isWater[i][j] == 1 {
				res[i][j] = 0
				queue = append(queue, [2]int{i, j})
				continue
			}

			res[i][j] = -1
		}
	}

	directions := [][2]int{{1, 0}, {0, 1}, {-1, 0}, {0, -1}}

	for len(queue) > 0 {
		x := queue[0][0]
		y := queue[0][1]
		queue = queue[1:]

		for _, direction := range directions {
			nx, ny := x+direction[0], y+direction[1]

			if nx >= 0 && nx < len(isWater) && ny >= 0 && ny < len(isWater[0]) && res[nx][ny] == -1 {
				res[nx][ny] = res[x][y] + 1
				queue = append(queue, [2]int{nx, ny})
			}
		}
	}

	return res
}

```
['Go']