The description of the question can be found in the following link:
https://leetcode.com/problems/maximum-subarray/
My Code:
class Solution:
def maxSubArray(self, nums: List[int]) -> int:
List1 = [];
Maximum = -2**31+1;
for i in range(len(nums)):
List1.append(nums[i]);
Maximum= max(sum(List1), Maximum)
if(sum(List1) < 0):
List1 = [];
return(Maximum);
Explain: Keep going until first get a negative summation. Then we start a new array from the next element.