DSA Problems and their solutions.
View the Project on GitHubvaibhavvikas/dsa-problems
TC: O(n) SC: O(1)
def maxSubArray(self, A): curSum = maxSum = A[0] for num in A[1:]: curSum = max(num, curSum + num) maxSum = max(maxSum, curSum) return maxSum