Rotate an N \times N matrix by 90 degrees clockwise (transpose then reverse each row).
Difficulty: Hard
Phase: 6 · Mixed Logical Challenges
XP Reward: 30 XP
Topics: Mixed Logical Challenges, Hard
Supported Languages: Python, JavaScript, C, C++, Java
Problem Description
Given N followed by N x N matrix, rotate 90 degrees clockwise and print. Input Format: Read input from standard input (stdin). Output Format: Print the result to standard output (stdout).
Constraints
- -10^9 <= N <= 10^9
Examples
Example 1
Input: 3 1 2 3 4 5 6 7 8 9
Output: 7 4 1 8 5 2 9 6 3
Explanation: Sample execution for input 3 1 2 3 4 5 6 7 8 9