public class Solution {
public int[,] MatrixReshape(int[,] nums, int r, int c) {
if (nums.Length < r * c) return nums;
int[,] result = new int[r,c];
List<int> temp = new List<int>();
//先放到集合里
foreach (var item in nums)
{
temp.Add(item);
}
int k = 0;
for (int i = 0; i < r; i++)
{
for (int j = 0; j < c; j++)
{
result[i, j] = temp[k++];
}
}
return result;
}
}