Skip to content

Commit d4b32dd

Browse files
committed
feat: easy: find_words_containing_character.rs
1 parent ee467e6 commit d4b32dd

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
struct Solution;
2+
3+
impl Solution {
4+
pub fn find_words_containing(words: Vec<String>, x: char) -> Vec<i32> {
5+
let mut out = vec![];
6+
7+
for (i, w) in words.iter().enumerate() {
8+
if w.contains(x) {
9+
out.push(i as i32)
10+
}
11+
}
12+
13+
out
14+
}
15+
}

src/easy/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ mod check_if_one_string_swap_can_make_strings_equal;
33
mod clear_digits;
44
mod count_pairs_whose_sum_is_less_than_target;
55
mod find_the_difference;
6+
mod find_words_containing_character;
67
mod guess_number_higher_or_lower;
78
mod image_smoother;
89
mod last_stone_weight;

0 commit comments

Comments
 (0)