diff --git a/transpose-matrix/sol.rs b/transpose-matrix/sol.rs new file mode 100644 index 0000000..b04bcc5 --- /dev/null +++ b/transpose-matrix/sol.rs @@ -0,0 +1,12 @@ +impl Solution { + pub fn transpose(matrix: Vec>) -> Vec> { + let n = matrix[0].len(); + (0..n).into_iter() + .map(|i| matrix + .iter() + .map(|row| row[i]) + .collect() + ) + .collect() + } +} \ No newline at end of file