Maximum subarray sum

This Question Was Asked By Amazon

Given an array of numbers, find the maximum sum of any contiguous subarray of the array.

Write a function solve that have the following parameter(s):
1.) a = an array of integers

Example
Input:
[34, -50, 42, 14, -5, 86] Output:
137

Explanation The subarray [42, 14, -5, 86], the sum of this will give you output 137.

Constraints
• The length of an array should be greater than 0 and less than 800.
• The elements of an array should be greater than 0 and less than 1000.