Loading...
Given an m x n matrix, reshape it to r x c. If not possible, return the original matrix.
Output each row on a line, space-separated.
1,2 3,4 1 4
1 2 3 4
1,2 and 3,4, but the actual matrix is defined by the first line as a 1×2 matrix with values 1 and 2, and the second line as a 1×2 matrix with values 3 and 4.1 4, meaning 1 row and 4 columns, but since the total number of elements in the original matrix is 4 (2 elements per row × 2 rows), we can reshape it to 1×4.[1, 2, 3, 4].1 2 3 4