SpiralMatrixII

int top = 0, bottom = n - 1, left = 0, right = n - 1;
 if (n % 2 != 0)
            res[n / 2][n / 2] = k;