use std::collections::HashMap; pub fn repeated_n_times(a: Vec) -> i32 { let mut hm = HashMap::new(); for i in a { if hm.contains_key(&i) { return i; } else { hm.insert(i, 0); } } return 0; // This is unecessary given the problem constraints, but rust needs it to be happy } pub fn main() { println!("Expected: 3"); println!("Got: {}", repeated_n_times(vec![1 ,2, 3, 3])) }