input: from typing import List
  
  def transpose(A: List[List[int]]) -> List[List[int]]:
      """
      Optimize the given 2d array by computing its transpose and storing the result in a new array.
      >>> transpose([[1, 2, 3], [4, 5, 6]])
      [[1, 4], [2, 5], [3, 6]]
      >>> transpose([[1, 2], [3, 4], [5, 6]])
      [[1, 3, 5], [2, 4, 6]]
      """
      n = len(A)
      m = len(A[0])
      
      B = [[0 for x in range(n)] for x in range(m)]
      
      for i in range(n):
          for j in range(m):
              B[j][i] = A[i][j]
      
      return B
output:     n = len(A)
      m = len(A[0])
      
      B = [[0 for x in range(n)] for x in range(m)]
      
      for i in range(n):
          for j in range(m):
              B[j][i] = A[i][j]
      
      return B