Distribute Candies LeetCode solution in Rust

1
use std::collections::HashSet;
2

3
impl Solution {
4
pub fn distribute_candies(candy_type: Vec<i32>) -> i32 {
5
let len = candy_type.len();
6
let hashset: HashSet<i32> = candy_type.into_iter().collect();
7
std::cmp::min(len / 2, hashset.len()) as i32
8
}
9
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0