fn main() { println!("Hello, world!"); } struct Solution; use std::collections::HashMap; impl Solution { pub fn majority_element(nums: Vec) -> i32 { let mut table = HashMap::new(); for num in nums { *table.entry(num).or_insert(1) += 1; } *table.iter().reduce(|a,b| if a.1 > b.1 {a} else {b}).unwrap().0 } }