Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 906 Bytes

_867. Transpose Matrix.md

File metadata and controls

37 lines (25 loc) · 906 Bytes

All prompts are owned by LeetCode. To view the prompt, click the title link above.

Back to top


First completed : June 15, 2024

Last updated : June 15, 2024


Related Topics : Array, Matrix, Simulation

Acceptance Rate : 73.12 %


Solutions

Python

class Solution:
    def transpose(self, matrix: List[List[int]]) -> List[List[int]]:
        output = [[0] * len(matrix) for _ in range(len(matrix[0]))]

        for row in range(0, len(matrix)) :
            for col in range(0, len(matrix[0])) :
                output[col][row] = matrix[row][col]

        return output