From a913ae57b40ac60756fdd85e90ddc4dd86b45404 Mon Sep 17 00:00:00 2001 From: Shubham Bhardwaj <32607282+rockstar2406@users.noreply.github.com> Date: Fri, 6 Oct 2023 18:54:49 +0530 Subject: [PATCH] Create merge-strings-alternately.py merge-strings-alternately - https://leetcode.com/problems/merge-strings-alternately in python --- merge-strings-alternately.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 merge-strings-alternately.py 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:] + +