input: Write a function to improve the time complexity of the given Python program that finds the maximum sum of any two distinct elements in an array. The function should return the maximum sum. 
  
  def find_max_sum(arr):
      if len(arr) < 2:
          return 0
      first_max = max(arr)
      arr.remove(first_max)
      second_max = max(arr)
      return first_max + second_max
  
  assert find_max_sum([1, 2, 3, 4]) == 7
  assert find_max_sum([4, 3, 2, 7]) == 11
  assert find_max_sum([1, 1, 1, 1]) == 2
  assert find_max_sum([]) == 0
  assert find_max_sum([10]) == 0
output: def find_max_sum(arr):
      if len(arr) < 2:
          return 0
      first_max = second_max = float('-inf')
      for num in arr:
          if num > first_max:
              second_max = first_max
              first_max = num
          elif num > second_max and num != first_max:
              second_max = num
      return first_max + second_max