add new solutions

This commit is contained in:
kanna5 2026-01-05 16:48:03 +09:00
parent d798d5e8c9
commit 886b5e0a8e
Signed by: kkyy
GPG key ID: 06332F3965E9B0CF
34 changed files with 1164 additions and 0 deletions

View file

@ -0,0 +1,21 @@
package q48
func rotateCell(matrix [][]int, x, y int) {
t := matrix[y][x]
for range 4 {
nextX, nextY := len(matrix)-1-y, x
matrix[nextY][nextX], t = t, matrix[nextY][nextX]
x, y = nextX, nextY
}
}
func rotate(matrix [][]int) {
w := len(matrix)
for y := range w / 2 {
for x := y; x < w-y-1; x++ {
rotateCell(matrix, x, y)
}
}
}
var _ = rotate