Your question is Maximum Subarray Using Kadane. 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 largest possible sum of any non-empty contiguous subarray. The solution should use Kadane's Algorithm, which scans the array once and decides at each position whether to extend the current subarray or start a new one.
def max_subarray(nums):