Seawolf 发表于 2020-9-23 03:16:44

Leetcode 867. Transpose Matrix

Given a matrix A, return the transpose of A.

The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and column indices of the matrix.





Example 1:

Input: [,,]
Output: [,,]
Example 2:

Input: [,]
Output: [,,]


Note:

1 <= A.length <= 1000
1 <= A.length <= 1000

class Solution:
    def transpose(self, A: List]) -> List]:
      result = [ for _ in A]
      for i in range(len(A)):
            for j in range(len(A)):
                result = A
               
      return result
页: [1]
查看完整版本: Leetcode 867. Transpose Matrix