Write a component that computes the transpose of a hardcoded 2D array and displays it.
HardProblem Statement
Write a component that computes the transpose of a hardcoded 2D array and displays it.
Sample Input
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
Sample Output
Transposed Array: [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
import React from "react";
const TransposeMatrix = () => {
return (
<div>
{/* Display the transposed array */}
</div>
);
};
export default TransposeMatrix;
Input
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
Expected Output
Transposed Array: [[1, 4, 7], [2, 5, 8], [3, 6, 9]]