Skip to content
DeepForgeby svx
All problems
EasyLinear Algebrala-002

Matrix Transpose

Problem

Return the transpose of matrix A. Element (i, j) becomes (j, i).

Hint

The element at A[i][j] in the original becomes T[j][i].

Test cases

case 1
in: [[[1,2,3],[4,5,6]]]
expected: [[1,4],[2,5],[3,6]]
case 2
in: [[[1,2],[3,4]]]
expected: [[1,3],[2,4]]
case 3
in: [[[1,2,3]]]
expected: [[1],[2],[3]]
Starter codePython
def transpose(A):
    # Your code here
    pass

3 test cases · run your code against them in the editor