Transpose Matrix

Easy
Arrays Array Matrix

Given a matrix, return its transpose. Rows become columns.

Constraints

1 ≤ m, n ≤ 1000

Examples

Example 1:
Input: 1 2 3 4 5 6
Output: 1 4 2 5 3 6
Example 2:
Input: 1 2 3 4 5 6
Output: 1 3 5 2 4 6
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.