Looking for suggestions to speed up my solution to the 3 Sum problem on leetcode. Goal is finding all unique combos of 3 values from a vec of ints that add up to 0. My solution runs in about 340ms on the leetcode site. My assumption is that converting from a HashSet is faster than deduping a Vec, but I'm also sure there must be a way to short circuit the introduction of duplicates in the first place.

```
pub fn three_sum(nums: Vec<i32>) -> Vec<Vec<i32>> {
if nums.len() < 3 { return vec!() }
let mut nums = nums;
nums.sort();
nums.iter()
.take_while(|target| **target <= 0)
.enumerate()
.filter(|(i,target)| *i == 0 || nums[i-1] != **target)
.flat_map(|(i,target)| {
let twosum = Solution::two_sum(nums[i+1..].to_vec(), *target);
twosum.into_iter().collect::<Vec<Vec<i32>>>()
})
.collect::<Vec<Vec<i32>>>()
}
pub fn two_sum(nums: Vec<i32>, target: i32) -> HashSet<Vec<i32>> {
let mut memo: HashSet<i32> = HashSet::new();
let mut res: HashSet<Vec<i32>> = HashSet::new();
for n in nums.iter() {
match memo.get(&(-1*(target + n))) {
None => {memo.insert(*n);},
Some(&j) => { res.insert(vec!(target,*n,j));
}
}
}
res
}
```