fn main() { println!("Hello, world!"); } struct Solution; use std::collections::HashMap; impl Solution { pub fn diagonal_sort(mut mat: Vec>) -> Vec> { let mut a = HashMap::new(); for (i, row) in mat.iter().enumerate() { for (ii, value) in row.iter().enumerate() { a.entry(i-ii).and_modify(|x: &mut Vec<&i32>| {x.push(value)}).or_insert(vec![value]); } } for i in a.values_mut() { i.sort(); println!("{i:?}"); } mat } }