All Problems

Problem title

Difficulty

Avg time to solve

Digit Product

Moderate

25 mins

Subarrays With Equal 0’s, 1’s and 2’s

Hard

--

Length of the Largest Subarray

Moderate

25 mins

Sort the Permutation

Moderate

--

Check AP Sequence

Moderate

--

Palindromic Rearrangement

Easy

--

Special Subarray

Moderate

--

Twin Pairs

Easy

15 mins

Problem Selection

Easy

30 mins

Transpose of a Matrix

Easy

15 mins

Problem

Submissions

Avg. time to solve

15 min

Success Rate

80%

Problem Statement

```
Let matrix be :
1 2
3 4
Then transpose of the matrix will be:
1 3
2 4
```

```
The first line of input contains an integer ‘T’, denoting the number of test cases.
The first line of each test case contains two space-separated integers, ‘M’ and ‘N’, representing the size of the matrices.
The next ‘M’ lines of each test case contain ‘N’ space-separated integers, representing the elements of ‘MAT’.
```

```
For each test case, print the transpose of the matrix.
Print output of each test case in a separate line.
```

```
You do not need to print anything. It has already been taken care of. Just implement the given function.
```

```
1 <= T <= 10
1 <= M, N <= 3*10^3
0 <= MAT[i][j] <= 10^7
Time Limit: 1 sec
```

```
2
2 2
1 2
3 4
3 2
1 2
2 3
3 4
```

```
1 3
2 4
1 2 3
2 3 4
```

```
For test case 1:
The transpose of the matrix will be:
1 3
2 4
For test case 2:
The transpose of the matrix will be:
1 2 3
2 3 4
```

```
2
2 3
1 2 3
3 4 5
2 1
1
2
```

```
1 3
2 4
3 5
1 2
```

Java (SE 1.8)

Console

Sample Test Case

Custom Test Case

Download Test Cases

Test Case 1

Test Case 2

Test Case 3

Saving Code...

Full Screen Mode

Change Theme

Solution submission not allowed

Save Code

Reset Code