|
| 1 | +<h2><a href="https://leetcode.com/problems/string-matching-in-an-array">1524. String Matching in an Array</a></h2><h3>Easy</h3><hr><p>Given an array of string <code>words</code>, return <em>all strings in </em><code>words</code><em> that is a <strong>substring</strong> of another word</em>. You can return the answer in <strong>any order</strong>.</p> |
| 2 | + |
| 3 | +<p>A <strong>substring</strong> is a contiguous sequence of characters within a string</p> |
| 4 | + |
| 5 | +<p> </p> |
| 6 | +<p><strong class="example">Example 1:</strong></p> |
| 7 | + |
| 8 | +<pre> |
| 9 | +<strong>Input:</strong> words = ["mass","as","hero","superhero"] |
| 10 | +<strong>Output:</strong> ["as","hero"] |
| 11 | +<strong>Explanation:</strong> "as" is substring of "mass" and "hero" is substring of "superhero". |
| 12 | +["hero","as"] is also a valid answer. |
| 13 | +</pre> |
| 14 | + |
C7DF
| 15 | +<p><strong class="example">Example 2:</strong></p> |
| 16 | + |
| 17 | +<pre> |
| 18 | +<strong>Input:</strong> words = ["leetcode","et","code"] |
| 19 | +<strong>Output:</strong> ["et","code"] |
| 20 | +<strong>Explanation:</strong> "et", "code" are substring of "leetcode". |
| 21 | +</pre> |
| 22 | + |
| 23 | +<p><strong class="example">Example 3:</strong></p> |
| 24 | + |
| 25 | +<pre> |
| 26 | +<strong>Input:</strong> words = ["blue","green","bu"] |
| 27 | +<strong>Output:</strong> [] |
| 28 | +<strong>Explanation:</strong> No string of words is substring of another string. |
| 29 | +</pre> |
| 30 | + |
| 31 | +<p> </p> |
| 32 | +<p><strong>Constraints:</strong></p> |
| 33 | + |
| 34 | +<ul> |
| 35 | + <li><code>1 <= words.length <= 100</code></li> |
| 36 | + <li><code>1 <= words[i].length <= 30</code></li> |
| 37 | + <li><code>words[i]</code> contains only lowercase English letters.</li> |
| 38 | + <li>All the strings of <code>words</code> are <strong>unique</strong>.</li> |
| 39 | +</ul> |
0 commit comments