Find the contiguous subarray within an integer array that yields the maximum possible sum and return that sum.
Implement max_subarray(nums), where nums is a non-empty list of integers. Return an integer representing the largest sum among all contiguous, non-empty subarrays.
nums, a non-empty list of integersdef max_subarray(nums):