class Solution
{
//Function to reverse the columns of a matrix.
static void reverseCol(int matrix[][])
{
for(int i=0; i<matrix.length; i++){
for(int j=0; j<matrix[i].length/2; j++)
{
int temp = matrix[i][j];
matrix[i][j] = matrix[i][matrix[i].length-j-1];
matrix[i][matrix[i].length-j-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