transpose-matrix
This commit is contained in:
parent
17e37c823d
commit
0a8bf37562
|
@ -0,0 +1,12 @@
|
|||
impl Solution {
|
||||
pub fn transpose(matrix: Vec<Vec<i32>>) -> Vec<Vec<i32>> {
|
||||
let n = matrix[0].len();
|
||||
(0..n).into_iter()
|
||||
.map(|i| matrix
|
||||
.iter()
|
||||
.map(|row| row[i])
|
||||
.collect()
|
||||
)
|
||||
.collect()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue