← All problemsSign in

Nooby and Matrix

Nooby has a 2D Matrix of MxN and a Positive integer R. He wants to rotate it R times. Rotation should be in clockwise direction. Print the matrix . Rotation of a 4x5 matrix is represented by the following figure. Note that in one rotation, you have to shift elements by one step only (refer sample tests for more clarity). A11 ⇒ A12 ⇒ A13 ⇒ A14 ⇒ A15 ⇑ ⇓ A21   A22 ⇒ A23 ⇒ A24   A25 ⇑   ⇑   ⇓ ⇓ A31

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start