## Solutions ### Pointer ```python class Solution(object): def mergeAlternately(self, word1, word2): """ :type word1: str :type word2: str :rtype: str """ p = 0 merged_string = [] while p < len(word1) and p < len(word2): merged_string.append(word1[p]) merged_string.append(word2[p]) p+=1 if p < len(word1): merged_string.append(word1[p:]) elif p < len(word2): merged_string.append(word2[p:]) return "".join(merged_string) # time complexity: On # space: On ``` - think `pointer` at first - learned - 把 string 转换成 array 处理 - Complexity Analysis - Time complexity is On - Space complexity is On