input: Write a python function to find the maximum sum of a contiguous subarray.
  assert max_subarray_sum([2, -5, 4, -2, 7, -1]) == 9
  assert max_subarray_sum([-2, -3, 4, -1, -2, 1, 5, -3]) == 7
  assert max_subarray_sum([1, 2, 3, 4, 5]) == 15
  assert max_subarray_sum([-1, -2, -3, -4]) == -1
output: def max_subarray_sum(arr):
      max_sum = arr[0]
      current_sum = arr[0]
      for num in arr[1:]:
          current_sum = max(num, current_sum + num)
          max_sum = max(max_sum, current_sum)
      return max_sum