input: Write a python function to normalize a matrix such that the values range from 0 to 1.
  assert normalize_matrix([[1, 2], [3, 4]]) == [[0.0, 0.3333333333333333], [0.6666666666666666, 1.0]]
  assert normalize_matrix([[10, 20, 30], [40, 50, 60], [70, 80, 90]]) == [[0.0, 0.125, 0.25], [0.375, 0.5, 0.625], [0.75, 0.875, 1.0]]
  assert normalize_matrix([[2, 4, 6], [8, 10, 12], [14, 16, 18]]) == [[0.0, 0.125, 0.25], [0.375, 0.5, 0.625], [0.75, 0.875, 1.0]]
output: def normalize_matrix(matrix):
      flat_matrix = [item for sublist in matrix for item in sublist]
      min_val = min(flat_matrix)
      max_val = max(flat_matrix)
      
      def normalize(value):
          return (value - min_val) / (max_val - min_val)
      
      return [[normalize(value) for value in row] for row in matrix]