3ms simple solution
Runtime: 3 ms, faster than 91.95% of Rust online submissions for Reshape the Matrix.\nMemory Usage: 2.4 MB, less than 32.18% of Rust online submissions for Resh
Runtime: 3 ms, faster than 91.95% of Rust online submissions for Reshape the Matrix.\nMemory Usage: 2.4 MB, less than 32.18% of Rust online submissions for Reshape the Matrix.\n```\nimpl Solution {\n    pub fn matrix_reshape(mat: Vec<Vec<i32>>, r: i32, c: i32) -> Vec<Vec<i32>> {\n        if (r*c) as usize != mat.len()*mat[0].len(){\n            mat //illegal matrix return\n        } else{\n            mat\n            .concat() //combine\n            .chunks(c as usize) //devide\n            .map(|row| row.to_vec())\n            .collect() //restructure\n        }\n    }\n}\n``
['Rust']