1
This commit is contained in:
16
solutions/lc1768.py
Normal file
16
solutions/lc1768.py
Normal file
@@ -0,0 +1,16 @@
|
||||
class Solution:
|
||||
def mergeAlternately(self, word1: str, word2: str) -> str:
|
||||
word3 = ""
|
||||
j = i = 0
|
||||
len1 = len(word1)
|
||||
len2 = len(word2)
|
||||
while j < len1 or i < len2:
|
||||
if j < len1:
|
||||
word3 += "".join(word1[j])
|
||||
j += 1
|
||||
|
||||
if i < len2:
|
||||
word3 += "".join(word2[i])
|
||||
i += 1
|
||||
|
||||
return word3
|
||||
Reference in New Issue
Block a user