package main
import "log"
func main() {
log.Println(Rotate90(map[int]map[int]string{
0 : { 0 : "00", 1 : "01", 2 : "02", 3 : "03", 4 : "04" },
1 : { 0 : "10", 1 : "11", 2 : "12", 3 : "13", 4 : "14" },
2 : { 0 : "20", 1 : "21", 2 : "22", 3 : "23", 4 : "24" },
3 : { 0 : "30", 1 : "31", 2 : "32", 3 : "33", 4 : "34" },
4 : { 0 : "40", 1 : "41", 2 : "42", 3 : "43", 4 : "44" }}))
}
func Rotate90(image map[int]map[int]string) map[int]map[int]string {
targetNum:= len(image) - 1
for i := 0; i < len(image) - 1;i++ {
// change values
for j := i; j < targetNum - i; j++ {
temp := image[i][j]
image[i][j] = image[j][targetNum-i]
image[j][targetNum-i] = image[targetNum-i][targetNum-j]
image[targetNum-i][targetNum-j] = image[targetNum-j][i]
image[targetNum-j][i] = temp
}
}
return image
}
result : map[
0:map[0:04 1:14 2:24 3:34 4:44]
1:map[0:03 1:13 2:23 3:33 4:43]
2:map[0:02 1:12 2:22 3:32 4:42]
3:map[0:01 1:11 2:21 3:31 4:41]
4:map[0:00 1:10 2:20 3:30 4:40]]