Last Updated: 17 Mar, 2018

Rotate Matrix K times

Moderate
Asked in companies
Josh Technology GroupUHGZoho Corporation

Problem statement

Given a matrix, clockwise rotate elements in it K times. Rotating the matrix by 90 degrees clockwise will be counted as 1.

See the sample input.

Input format :
Line 1 : Number of rows M and cols N in the matrix
Line 2 to M + 1 : MXN elements of the matrix
Line M + 2 : Integer K
Output Format :
 Just rotate the given matrix, no need to print it
Constraints :
 1 <= M <= 10^5
 1 <= N <= 10^5
 1 <= K <= 10^5