Practice String Matching in an Array
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given an array of string words, return all strings in words that are a substring of another word. You can return the answer in any order.
Source: String Matching in an Array on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
words = ["mass","as","hero","superhero"]
Output
["as","hero"]
# Example 2
Input
words = ["leetcode","et","code"]
Output
["et","code"]
# Example 3
Input
words = ["blue","green","bu"]
Output
[]
Constraints
1 <= words.length <= 100
1 <= words[i].length <= 30
words[i] contains only lowercase English letters.
All the strings of words are unique.
Related LeetCode Problems
Practice more problems similar to String Matching in an Array.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.