class Solution
{
//Function to exchange first column of a matrix with its last column.
static void exchangeColumns(int matrix[][])
{
int temp = 0;
for (int i=0; i<matrix.length; i++)
{
temp = matrix[i][0];
matrix[i][0] = matrix[i][matrix[i].length-1];
matrix[i][matrix[i].length-1] = temp;
}
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter