Rotate Matrix K Times Problem Statement
Given a matrix, rotate its elements clockwise by 90 degrees, K times.
Each rotation by 90 degrees counts as one.
Input:
Line 1: Two integers M and N, denoting the number of rows and columns of the matrix.
Line 2 to M + 1: The MxN elements of the matrix.
Line M + 2: An integer K, indicating the number of 90-degree rotations.
Output:
The matrix rotated K times clockwise. No need to print it.
Example:
Input:
M = 2
N = 2
Matrix = [[1, 2], [3, 4]]
K = 1
Output:
[[3, 1], [4, 2]]
Constraints:
1 ≤ M ≤ 105
1 ≤ N ≤ 105
1 ≤ K ≤ 105
Note:
You are required to implement the function that rotates the matrix, without printing the result directly.
Be the first one to answer
Add answer anonymously...
Top Josh Technology Group Software Developer Intern interview questions & answers
Popular interview questions of Software Developer Intern
>
Josh Technology Group Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app