LeetCode 1119. Remove Vowels from a String

Problem Statement


use std::collections::HashSet;
use std::iter::FromIterator;
impl Solution {
pub fn remove_vowels(s: String) -> String {
let (mut ans, mut j) = ("".to_string(), 0);
let vowel_set : HashSet<char> = HashSet::from_iter(vec!['a', 'e', 'i', 'o', 'u']);
while j < s.len() {
let sj = s.chars().nth(j).unwrap();
if !vowel_set.contains(&sj) {
ans.push(sj);
}
j+= 1;
}
return ans;
}
}