input: Write a function to improve the given Python program to reduce its time complexity. The original function finds the maximum sum of any two elements in an array by using two nested loops, which results in a time complexity of O(n^2). The improved function should achieve the same result with a better time complexity. The function should return the maximum sum of any two elements in the array. If the array is empty, the function should return 0.
  
  assert find_max_sum([1, 2, 3, 4])==7
  assert find_max_sum([4, 3, 1, 2])==7
  assert find_max_sum([5, 1, 4, 3])==9
  assert find_max_sum([])==0
  assert find_max_sum([10])==0
output: def find_max_sum(arr):
      if len(arr) < 2:
          return 0
      max1, max2 = float('-inf'), float('-inf')
      for num in arr:
          if num > max1:
              max2 = max1
              max1 = num
          elif num > max2:
              max2 = num
      return max1 + max2