diff --git a/merge-strings-alternately.py b/merge-strings-alternately.py new file mode 100644 index 0000000..cf95773 --- /dev/null +++ b/merge-strings-alternately.py @@ -0,0 +1,8 @@ +class Solution: + def mergeAlternately(self, word1: str, word2: str) -> str: + result=[] + for i in range(min(len(word1),len(word2))): + result.append(word1[i]+word2[i]) + return ''.join(result)+word1[i+1:]+word2[i+1:] + +