input: Write a function to improve the time complexity of a given function that finds the maximum sum of any two distinct elements in an array. The original function uses a nested loop which results in an O(n^2) time complexity. The improved function should use a two-pointer technique to achieve an O(n) time complexity.
  assert find_max_sum([1, 2, 3, 4])==7
  assert find_max_sum([4, 2, 3, 1])==7
  assert find_max_sum([5, 9, 2, 7])==16
  assert find_max_sum([1, 3, 1, 3, 1])==6
  assert find_max_sum([1])==0
output: def find_max_sum(arr):
      if len(arr) < 2:
          return 0
      first_max = max(arr[0], arr[1])
      second_max = min(arr[0], arr[1])
      for num in arr[2:]:
          if num > first_max:
              second_max = first_max
              first_max = num
          elif num > second_max:
              second_max = num
      return first_max + second_max