aboutsummaryrefslogtreecommitdiff
path: root/determine_string_halves.rs
diff options
context:
space:
mode:
Diffstat (limited to 'determine_string_halves.rs')
-rw-r--r--determine_string_halves.rs18
1 files changed, 0 insertions, 18 deletions
diff --git a/determine_string_halves.rs b/determine_string_halves.rs
deleted file mode 100644
index f7f4303..0000000
--- a/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));
-}