Skip to content

Commit f756848

Browse files
committed
Create README - LeetHub
1 parent fcdc57d commit f756848

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<h2><a href="https://leetcode.com/problems/split-strings-by-separator">2881. Split Strings by Separator</a></h2><h3>Easy</h3><hr><p>Given an array of strings <code>words</code> and a character <code>separator</code>, <strong>split</strong> each string in <code>words</code> by <code>separator</code>.</p>
2+
3+
<p>Return <em>an array of strings containing the new strings formed after the splits, <strong>excluding empty strings</strong>.</em></p>
4+
5+
<p><strong>Notes</strong></p>
6+
7+
<ul>
8+
<li><code>separator</code> is used to determine where the split should occur, but it is not included as part of the resulting strings.</li>
9+
<li>A split may result in more than two strings.</li>
10+
<li>The resulting strings must maintain the same order as they were initially given.</li>
11+
</ul>
12+
13+
<p>&nbsp;</p>
14+
<p><strong class="example">Example 1:</strong></p>
15+
16+
<pre>
17+
<strong>Input:</strong> words = [&quot;one.two.three&quot;,&quot;four.five&quot;,&quot;six&quot;], separator = &quot;.&quot;
18+
<strong>Output:</strong> [&quot;one&quot;,&quot;two&quot;,&quot;three&quot;,&quot;four&quot;,&quot;five&quot;,&quot;six&quot;]
19+
<strong>Explanation: </strong>In this example we split as follows:
20+
21+
&quot;one.two.three&quot; splits into &quot;one&quot;, &quot;two&quot;, &quot;three&quot;
22+
&quot;four.five&quot; splits into &quot;four&quot;, &quot;five&quot;
23+
&quot;six&quot; splits into &quot;six&quot;
24+
25+
Hence, the resulting array is [&quot;one&quot;,&quot;two&quot;,&quot;three&quot;,&quot;four&quot;,&quot;five&quot;,&quot;six&quot;].</pre>
26+
27+
<p><strong class="example">Example 2:</strong></p>
28+
29+
<pre>
30+
<strong>Input:</strong> words = [&quot;$easy$&quot;,&quot;$problem$&quot;], separator = &quot;$&quot;
31+
<strong>Output:</strong> [&quot;easy&quot;,&quot;problem&quot;]
32+
<strong>Explanation:</strong> In this example we split as follows:
33+
34+
&quot;$easy$&quot; splits into &quot;easy&quot; (excluding empty strings)
35+
&quot;$problem$&quot; splits into &quot;problem&quot; (excluding empty strings)
36+
37+
Hence, the resulting array is [&quot;easy&quot;,&quot;problem&quot;].
38+
</pre>
39+
40+
<p><strong class="example">Example 3:</strong></p>
41+
42+
<pre>
43+
<strong>Input:</strong> words = [&quot;|||&quot;], separator = &quot;|&quot;
44+
<strong>Output:</strong> []
45+
<strong>Explanation:</strong> In this example the resulting split of &quot;|||&quot; will contain only empty strings, so we return an empty array []. </pre>
46+
47+
<p>&nbsp;</p>
48+
<p><strong>Constraints:</strong></p>
49+
50+
<ul>
51+
<li><code>1 &lt;= words.length &lt;= 100</code></li>
52+
<li><code>1 &lt;= words[i].length &lt;= 20</code></li>
53+
<li>characters in <code>words[i]</code> are either lowercase English letters or characters from the string <code>&quot;.,|$#@&quot;</code> (excluding the quotes)</li>
54+
<li><code>separator</code> is a character from the string <code>&quot;.,|$#@&quot;</code> (excluding the quotes)</li>
55+
</ul>

0 commit comments

Comments
 (0)