9 lines
307 B
Rust
9 lines
307 B
Rust
pub fn contains_duplicate(numbers: Vec<i32>) -> bool {
|
|
// Uncomment FromIterator in Leetcode since they're using Rust Edition 2018.
|
|
// Edition 2021 has this trait in its prelude.
|
|
|
|
// use std::iter::FromIterator;
|
|
std::collections::HashSet::<_>::from_iter(numbers.iter()).len()
|
|
!= numbers.len()
|
|
}
|