Skip to content

Commit 63e201a

Browse files
committed
Create README - LeetHub
source:10506b27c127fecb682bbefc768caab96f9db1ea
1 parent 80e6fcc commit 63e201a

File tree

1 file changed

+45
-0
lines changed
  • 공예영/11주차/1768-merge-strings-alternately

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<h2><a href="https://leetcode.com/problems/merge-strings-alternately">1894. Merge Strings Alternately</a></h2><h3>Easy</h3><hr><p>You are given two strings <code>word1</code> and <code>word2</code>. Merge the strings by adding letters in alternating order, starting with <code>word1</code>. If a string is longer than the other, append the additional letters onto the end of the merged string.</p>
2+
3+
<p>Return <em>the merged string.</em></p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong class="example">Example 1:</strong></p>
7+
8+
<pre>
9+
<strong>Input:</strong> word1 = &quot;abc&quot;, word2 = &quot;pqr&quot;
10+
<strong>Output:</strong> &quot;apbqcr&quot;
11+
<strong>Explanation:</strong>&nbsp;The merged string will be merged as so:
12+
word1: a b c
13+
word2: p q r
14+
merged: a p b q c r
15+
</pre>
16+
17+
<p><strong class="example">Example 2:</strong></p>
18+
19+
<pre>
20+
<strong>Input:</strong> word1 = &quot;ab&quot;, word2 = &quot;pqrs&quot;
21+
<strong>Output:</strong> &quot;apbqrs&quot;
22+
<strong>Explanation:</strong>&nbsp;Notice that as word2 is longer, &quot;rs&quot; is appended to the end.
23+
word1: a b
24+
word2: p q r s
25+
merged: a p b q r s
26+
</pre>
27+
28+
<p><strong class="example">Example 3:</strong></p>
29+
30+
<pre>
31+
<strong>Input:</strong> word1 = &quot;abcd&quot;, word2 = &quot;pq&quot;
32+
<strong>Output:</strong> &quot;apbqcd&quot;
33+
<strong>Explanation:</strong>&nbsp;Notice that as word1 is longer, &quot;cd&quot; is appended to the end.
34+
word1: a b c d
35+
word2: p q
36+
merged: a p b q c d
37+
</pre>
38+
39+
<p>&nbsp;</p>
40+
<p><strong>Constraints:</strong></p>
41+
42+
<ul>
43+
<li><code>1 &lt;= word1.length, word2.length &lt;= 100</code></li>
44+
<li><code>word1</code> and <code>word2</code> consist of lowercase English letters.</li>
45+
</ul>

0 commit comments

Comments
 (0)