use std::collections::HashSet; impl Solution { pub fn contains_duplicate(nums: Vec) -> bool { let mut exists = HashSet::new(); !nums.into_iter().all(|n| exists.insert(n)) } }