forked from CS3704-VT/tech-interview-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCode
More file actions
19 lines (19 loc) · 551 Bytes
/
Copy pathCode
File metadata and controls
19 lines (19 loc) · 551 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Solution(object):
def mergeAlternately(self, word1, word2):
"""
:type word1: str
:type word2: str
:rtype: str
"""
index = 0
result = ""
while index < len(word1):
result = result + word1[index] + word2[index]
index += 1
if index >= len(word1):
result += word2[index:]
return result
if index >= len(word2):
result += word1[index:]
return result
return result