mirror of
https://github.com/Threnklyn/advent-of-code-go.git
synced 2026-06-03 18:58:27 +02:00
2020-day20: OOF, monster (hah) backtracking algo, and then some...
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user