Easy C# solution


  • 1
    B
    public void Rotate(int[,] matrix)
    		{
    			int buff;
    			int siz = (int)Math.Sqrt(matrix.Length);
    			siz--;
    			for (int j = 0; j < siz - j; j++)
    			{
    				for (int i = j; i < siz-j; i++)
    				{
    
    				buff = matrix[siz - i, j]; //d yi buff a
    				matrix[siz - i, j] = matrix[siz-j, siz - i];// c yi d ye
    				matrix[siz-j, siz - i] = matrix[i, siz-j];// b yi c ye
    				matrix[i, siz-j] = matrix[j, i];//a yi b ye 
    				matrix[j, i] = buff;//buff i a ya
    
    
    				}
    			}
    		}
    
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.