Turn a grid
medium
The first line has n. The next n lines each have n integers. Turn the grid a quarter turn clockwise and print it the same way.
Example 1: input
3 1 2 3 4 5 6 7 8 9
Output
7 4 1 8 5 2 9 6 3
Example 2: input
1 7
Output
7
Plus 1 hidden test when you check your answer.
Your solution
Read from standard input and print the answer. Run it on the examples as often as you like, then check it against every test.
Stuck?
Open hints one at a time. The write-up explains a full solution.
Discussion
Ask a question or share a tip. Please don’t post full solutions. Posts appear once a moderator approves them.
No posts yet.