input: def merge_sort(A: List[int], B: List[int]) -> List[int]:
      """ 
      Merge two sorted lists A and B into one sorted list by comparing elements of both lists 
      iteratively. If an element in A is smaller, it is added to the result list and the pointer 
      in A is moved to the next element. If an element in B is smaller, it is added to the result 
      list and the pointer in B is moved to the next element. This process continues until one of 
      the lists is exhausted, then the remaining elements of the other list are appended to the 
      result.
      
      >>> merge_sort([3, 6, 8, 10, 11], [2, 5, 7, 12])
      [2, 3, 5, 6, 7, 8, 10, 11, 12]
      >>> merge_sort([], [1, 2, 3])
      [1, 2, 3]
      >>> merge_sort([1, 3, 5], [2, 4])
      [1, 2, 3, 4, 5]
      >>> merge_sort([1], [1])
      [1, 1]
      """
output:     result = []
      i, j = 0, 0
  
      while i < len(A) and j < len(B):
          if A[i] < B[j]:
              result.append(A[i])
              i += 1
          else:
              result.append(B[j])
              j += 1
  
      result.extend(A[i:])
      result.extend(B[j:])
  
      return result