diff --git a/Merge Strings Alternately - Leetcode 1768/samad's_solution b/Merge Strings Alternately - Leetcode 1768/samad's_solution new file mode 100644 index 0000000..c94dd1e --- /dev/null +++ b/Merge Strings Alternately - Leetcode 1768/samad's_solution @@ -0,0 +1,15 @@ +class Solution(object): + def mergeAlternately(self, word1, word2): + """ + :type word1: str + :type word2: str + :rtype: str + """ + ans = "" + j = min(len(word2), len(word1)) + + for i in range(j): + ans += word1[i] + ans += word2[i] + + return ans + word1[j:] + word2[j:]