题目链接:https://www.lintcode.com/problem/rotate-image/description
/**
* @param matrix: a lists of integers
* @return: nothing
*/
func rotate (matrix *[][]int) {
// write your code here
if (matrix == nil || len(*matrix) == 0 || len((*matrix)[0]) == 0) {
return;
}
var length int = len(*matrix);
var i, j int;
for i = 0; i < length / 2; i++ {
for j = 0; j < (length + 1) / 2; j++{
var tmp int = (*matrix)[i][j];
(*matrix)[i][j] = (*matrix)[length - j - 1][i];
(*matrix)[length -j - 1][i] = (*matrix)[length - i - 1][length - j - 1];
(*matrix)[length - i - 1][length - j - 1] = (*matrix)[j][length - i - 1];
(*matrix)[j][length - i - 1] = tmp;
}
}
}