Tap here to switch tabs
Problem
Submissions

Problem: Transpose Matrix

easy
15 min
Explore how to transpose a matrix by swapping its rows and columns in a two-dimensional list. Learn to implement this core matrix operation efficiently, a key skill for solving matrix-related coding interview questions.

Statement

Given a matrix represented as a 2D integer list, return its transpose. The transpose of a matrix is obtained by swapping its rows with its columns or vice versa.

Constraints:

  • 1≤1 \leq m, n ≤100\leq 100

  • −104≤-10^4 \leq matrix[i][j] ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Transpose Matrix

easy
15 min
Explore how to transpose a matrix by swapping its rows and columns in a two-dimensional list. Learn to implement this core matrix operation efficiently, a key skill for solving matrix-related coding interview questions.

Statement

Given a matrix represented as a 2D integer list, return its transpose. The transpose of a matrix is obtained by swapping its rows with its columns or vice versa.

Constraints:

  • 1≤1 \leq m, n ≤100\leq 100

  • −104≤-10^4 \leq matrix[i][j] ≤104\leq 10^4