feat: add initial implementation of Cargo.toml, Cargo.lock, and lib.rs with find_words_containing function

This commit is contained in:
SquidSpirit 2025-08-18 18:38:22 +08:00
parent 50d62c34be
commit 21fffd8882
3 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "find_words_containing_character"
version = "0.1.0"

View File

@ -0,0 +1,6 @@
[package]
name = "find_words_containing_character"
version = "0.1.0"
edition = "2024"
[dependencies]

View File

@ -0,0 +1,12 @@
pub struct Solution;
impl Solution {
pub fn find_words_containing(words: Vec<String>, x: char) -> Vec<i32> {
words
.iter()
.enumerate()
.filter(|(_, word)| word.contains(x))
.map(|(index, _)| index as i32)
.collect()
}
}