Find the contiguous run of nums with the largest sum and return [best_sum, start, end], where start and end are the first and last positions of the run (both included).
If several runs share the largest sum, return the one that starts earliest, and among those the shortest. nums is not empty.
Example 1
Input:
max_subarray_range([-2, 1, -3, 4, -1, 2, 1, -5, 4])
Output:
[6, 3, 6]
The best run is [4, -1, 2, 1] from position 3 to 6 with sum 6.
Example 2
Input:
max_subarray_range([-3, -1, -2])
Output:
[-1, 1, 1]
All values are negative, so the best run is the single -1 at position 1.
1 <= len(nums) <= 2 * 10**5-10**4 <= nums[i] <= 10**4No results yet
Run your code to check it against the examples, or submit to run every test.