List-related:


Multi-Relational Condition in While Loop:

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)


String Cleaning & Filtering

1. 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).