matriz de transposición
public class Solution
{
public int[][] Transpose(int[][] matrix)
{
var trans = GenerateArray(matrix[0].Length,matrix.Length,0);
for(var i=0; i<matrix.Length;i++)
{
for(var j=0; j<matrix[0].Length;j++)
{
trans[j][i] = matrix[i][j];
}
}
return trans;
}
public static T[][] GenerateArray<T>(int row, int Col,T value)
{
var arr = new T[row][];
for (int i = 0; i < row; i++)
{
arr[i] = new T[Col];
for (int j = 0; j < Col; j++)
{
arr[i][j] = value;
}
}
return arr;
}
}
PrashantUnity