LearnPy Hub
← Arena
IntermediateRating 1200

Rotate K Times

Rotate an n×n matrix 90° clockwise k times and print it.

Input

n k, then n lines.

Output

n lines.

Sample 1

Input
3 1
1 2 3
4 5 6
7 8 9
Output
7 4 1
8 5 2
9 6 3

Sample 2

Input
2 2
1 2
3 4
Output
4 3
2 1
solution.py
Output appears here
Rotate K Times · Python Arena problem · LearnPy Hub