Easy
,String
,Two Pointers
1768. Merge Strings Alternately
You are given two strings word1
and word2
. Merge the strings by adding letters in alternating order, starting with word1
. If a string is longer than the other, append the additional letters onto the end of the merged string.
Return the merged string.
Example 1:
Example 2:
Example 3:
Constraints:
word1.length
, word2.length
<= 100word1
and word2
consist of lowercase English letters.MarsgoatApr 18, 2023
上面邏輯縮成一行
Ron ChenTue, Apr 18, 2023
練習 Java Stream API
Ron ChenTue, Apr 18, 2023
Note:
String.prototype.charAt()
如果超過索引值會回傳空字串
SheepApr 18, 2023