list + list (Concatenation): Creates a brand new list by joining the elements of the first and second lists.list * n (Replication): Repeats the list n times.range(len(nums)): Essential for iteration when you need to access every index one by one for manual processing.Useful when traversing two sequences simultaneously until the shorter one exhausts its bounds, followed by appending any remaining suffixes.
class Solution:
def mergeAlternately(self, word1: str, word2: str) -> str:
merged = []
i = 0
n1,n2 = len(word1), len(word2)
while n1 > i and n2 > i:
merged.append(word1[i])
merged.append(word2[i])
i += 1
merged.append(word1[i:])
merged.append(word2[i:])
return "".join(merged)
str.isalnum() (Recommended for $O(1)$ Space / In-Place Operations)Checks if a character is alphanumeric (Letters a-z, A-Z AND Digits 0-9).