Your question is Maximum Subarray Sum. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given an integer array nums, return the maximum sum of any non-empty contiguous subarray. The goal is to do better than checking all possible subarrays.
1 <= len(nums) <= 10^5-10^4 <= nums[i] <= 10^4