We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 53ce7c7 commit 0b9d90fCopy full SHA for 0b9d90f
contains-duplicate/DaleSeo.rs
@@ -0,0 +1,10 @@
1
+use std::collections::HashSet;
2
+
3
+// TC: O(n)
4
+// SC: O(n)
5
+impl Solution {
6
+ pub fn contains_duplicate(nums: Vec<i32>) -> bool {
7
+ let mut set = HashSet::new();
8
+ !nums.into_iter().all(|num| set.insert(num))
9
+ }
10
+}
0 commit comments