You are viewing a single comment's thread. Return to all comments →
Rust solution:
fn birds(arr: &[i32]) -> i32 { let mut map = HashMap::new(); for &i in arr { *map.entry(i).or_insert(0) += 1; } *map.iter().max_by_key(|(&id, &n)| (n, -id)).unwrap().0 }
Seems like cookies are disabled on this browser, please enable them to open this website
Migratory Birds
You are viewing a single comment's thread. Return to all comments →
Rust solution: