1408. String Matching in an Array Easy

@problem@discussion
#Array#String#String Matching



1/**
2 * [1408] String Matching in an Array
3 *
4 * Given an array of string words. Return all strings in words which is substring of another word in any order. 
5 * String words[i] is substring of words[j], if can be obtained removing some characters to left and/or right side of words[j].
6 *  
7 * Example 1:
8 * 
9 * Input: words = ["mass","as","hero","superhero"]
10 * Output: ["as","hero"]
11 * Explanation: "as" is substring of "mass" and "hero" is substring of "superhero".
12 * ["hero","as"] is also a valid answer.
13 * 
14 * Example 2:
15 * 
16 * Input: words = ["leetcode","et","code"]
17 * Output: ["et","code"]
18 * Explanation: "et", "code" are substring of "leetcode".
19 * 
20 * Example 3:
21 * 
22 * Input: words = ["blue","green","bu"]
23 * Output: []
24 * 
25 *  
26 * Constraints:
27 * 
28 * 	1 <= words.length <= 100
29 * 	1 <= words[i].length <= 30
30 * 	words[i] contains only lowercase English letters.
31 * 	It's guaranteed that words[i] will be unique.
32 * 
33 */
34pub struct Solution {}
35
36// problem: https://leetcode.com/problems/string-matching-in-an-array/
37// discuss: https://leetcode.com/problems/string-matching-in-an-array/discuss/?currentPage=1&orderBy=most_votes&query=
38
39// submission codes start here
40
41impl Solution {
42    pub fn string_matching(words: Vec<String>) -> Vec<String> {
43        vec![]
44    }
45}
46
47// submission codes end
48
49#[cfg(test)]
50mod tests {
51    use super::*;
52
53    #[test]
54    fn test_1408() {
55    }
56}
57


Back
© 2025 bowen.ge All Rights Reserved.