Skip to content

Commit

Permalink
Sync LeetCode submission Runtime - 16 ms (40.00%), Memory - 2.7 MB (2…
Browse files Browse the repository at this point in the history
…8.57%)
  • Loading branch information
hucancode committed Sep 12, 2024
1 parent 4c53c21 commit 6fbaee8
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
impl Solution {
pub fn count_consistent_strings(allowed: String, words: Vec<String>) -> i32 {
let allowed: std::collections::HashSet<_> = allowed.chars().collect();
words.iter()
.filter(|w| w.chars().all(|c| allowed.contains(&c)))
.count() as i32
}
}

0 comments on commit 6fbaee8

Please sign in to comment.