Problem of the day
You are given a square matrix ‘Mat’ of size ‘N’. You need to rotate ‘Mat’ by 90 degrees in the clockwise direction.
Note:
You must rotate the matrix in place, i.e., you must modify the given matrix itself. You must not allocate another square matrix for rotation.
For example
When,
‘N’ = 2 and ‘Mat’ = {{1, 2}, {3, 4}}, we must modify ‘Mat’ to {{3, 1}, {4, 2}}.
The first line contains an integer ‘N’, denoting the size of the matrix ‘Mat’.
Next ‘N’ lines contain ‘N’ integers each, denoting a row of ‘Mat’.
Output Format:
You must modify the given matrix ‘Mat’, such that it is rotated in the clockwise direction by 90 degrees.
1 <= N <= 100
1 <= Mat[i][j] <= 10^9
Time Limit: 1 sec