From 648f95d39ac747927df19e52e33b68a09f3cbe1b Mon Sep 17 00:00:00 2001 From: samadaderinto <81313734+samadaderinto@users.noreply.github.com> Date: Sat, 15 Nov 2025 14:37:11 +0100 Subject: [PATCH] Create samad's_solution --- .../samad's_solution | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Merge Strings Alternately - Leetcode 1768/samad's_solution 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:]