Class Solution
java.lang.Object
g1401_1500.s1408_string_matching_in_an_array.Solution
1408 - String Matching in an Array.<p>Easy</p>
<p>Given an array of string <code>words</code>. Return all strings in <code>words</code> which is substring of another word in <strong>any</strong> order.</p>
<p>String <code>words[i]</code> is substring of <code>words[j]</code>, if can be obtained removing some characters to left and/or right side of <code>words[j]</code>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> words = [“mass”,“as”,“hero”,“superhero”]</p>
<p><strong>Output:</strong> [“as”,“hero”]</p>
<p><strong>Explanation:</strong> “as” is substring of “mass” and “hero” is substring of “superhero”. [“hero”,“as”] is also a valid answer.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> words = [“leetcode”,“et”,“code”]</p>
<p><strong>Output:</strong> [“et”,“code”]</p>
<p><strong>Explanation:</strong> “et”, “code” are substring of “leetcode”.</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> words = [“blue”,“green”,“bu”]</p>
<p><strong>Output:</strong> []</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= words.length <= 100</code></li>
<li><code>1 <= words[i].length <= 30</code></li>
<li><code>words[i]</code> contains only lowercase English letters.</li>
<li>It’s <strong>guaranteed</strong> that <code>words[i]</code> will be unique.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
stringMatching
-