Create a component that rotates a hardcoded 2D matrix by 90 degrees clockwise and displays the result.
HardProblem Statement
Create a component that rotates a hardcoded 2D matrix by 90 degrees clockwise and displays the result.
Sample Input
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
Sample Output
Rotated Matrix: [[7, 4, 1], [8, 5, 2], [9, 6, 3]]
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
import React from "react";
const RotateMatrix = () => {
return (
<div>
{/* Display the rotated matrix */}
</div>
);
};
export default RotateMatrix;
Input
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
Expected Output
Rotated Matrix: [[7, 4, 1], [8, 5, 2], [9, 6, 3]]