diff options
Diffstat (limited to 'other/determine_string_halves.rs')
-rw-r--r-- | other/determine_string_halves.rs | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/other/determine_string_halves.rs b/other/determine_string_halves.rs deleted file mode 100644 index f7f4303..0000000 --- a/other/determine_string_halves.rs +++ /dev/null @@ -1,18 +0,0 @@ -use std::collections::HashSet; -struct Solution; - -impl Solution { - pub fn halves_are_alike(s: String) -> bool { - let vowels: HashSet<char> = HashSet::from(['a','e','i','o','u','A','E','I','O','U']); - s.chars() - .enumerate() - .filter(|(_, c)| vowels.contains(c)) - .map(|(i, _)| (s.len() as i32 - 2 * (i as i32) - 1).signum()) - .sum::<i32>() == 0 - } -} - -fn main() { - let s = String::from("book"); - print!("{}", Solution::halves_are_alike(s)); -} |