A few problems

This commit is contained in:
2022-05-29 20:21:38 +01:00
parent 2c0204028e
commit 2a7ec7e34b
17 changed files with 228 additions and 1 deletions

View File

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