input: Write a function to improve the time complexity of the given Python program that finds the maximum sum of any two elements in the array. The initial program has a time complexity of O(n^2), and the goal is to reduce it to O(n). The function should return the maximum sum as integer.
  def find_max_sum(arr):
      max_sum = 0
      left = 0
      right = len(arr) - 1
      while left < right:
          if arr[left] + arr[right] > max_sum:
              max_sum = arr[left] + arr[right]
          if arr[left] > arr[right]:
              right -= 1
          else:
              left += 1
      return max_sum
  assert find_max_sum([1, 3, 4, 7, 5])==12
  assert find_max_sum([10, 2, 9, 1, 5])==19
  assert find_max_sum([2, 2, 2, 2, 2])==4
  assert find_max_sum([0, 0, 0, 0, 0])==0
  assert find_max_sum([-1, -2, -3, -4, -5])==-3
output: def find_max_sum(arr):
      if len(arr) < 2:
          return 0
      max1 = max(arr[0], arr[1])
      max2 = min(arr[0], arr[1])
      for num in arr[2:]:
          if num > max1:
              max2 = max1
              max1 = num
          elif num > max2:
              max2 = num
      return max1 + max2