input: from typing import List
  
  def transform_matrix(matrix: List[List[int]]) -> List[List[int]]:
      """
      For a given 0-indexed m x n integer matrix, construct a new 0-indexed matrix termed result. Initialize result to be the same as matrix, then substitute any -1 element with the highest value found in its respective column.
  
      Return the result matrix.
  
      Examples:
      >>> matrix = [[1,2,-1],[4,-1,6],[7,8,9]]
      [[1,2,9],[4,8,6],[7,8,9]]
      >>> matrix = [[3,-1],[5,2]]
      [[3,2],[5,2]]
  
      Constraints:
      m == len(matrix)
      n == len(matrix[0])
      2 <= m, n <= 50
      -1 <= matrix[i][j] <= 100
      Each column is guaranteed to have at least one non-negative integer.
      """
output:     m = len(matrix)
      n = len(matrix[0])
  
      # Find the maximum value for each column
      max_in_column = [-float('inf')] * n
      for j in range(n):
          for i in range(m):
              if matrix[i][j] != -1:
                  max_in_column[j] = max(max_in_column[j], matrix[i][j])
  
      # Replace -1 with the maximum value in its column
      result = []
      for i in range(m):
          new_row = []
          for j in range(n):
              if matrix[i][j] == -1:
                  new_row.append(max_in_column[j])
              else:
                  new_row.append(matrix[i][j])
          result.append(new_row)
      
      return result