input: Write a python function to find the maximum sum of a contiguous subarray.
  assert max_subarray([-2,1,-3,4,-1,2,1,-5,4]) == 6
  assert max_subarray([1,2,3,4,-10]) == 10
  assert max_subarray([-1,-2,-3,-4]) == -1
output: def max_subarray(nums):
      max_current = max_global = nums[0]
      for num in nums[1:]:
          max_current = max(num, max_current + num)
          if max_current > max_global:
              max_global = max_current
      return max_global