mirror of
https://github.com/Threnklyn/advent-of-code-go.git
synced 2026-05-18 19:13:27 +02:00
13 lines
338 B
Go
13 lines
338 B
Go
package algos
|
|
|
|
// MirrorStringGrid returns the grid mirrored over the y-axis (i.e. left to right)
|
|
func MirrorStringGrid(grid [][]string) (flipped [][]string) {
|
|
for i := range grid {
|
|
flipped = append(flipped, []string{})
|
|
for j := len(grid[i]) - 1; j >= 0; j-- {
|
|
flipped[i] = append(flipped[i], grid[i][j])
|
|
}
|
|
}
|
|
return flipped
|
|
}
|