Open yeonghwanjeon opened 5 years ago
나의 풀이
class Solution(object): def maxSubArray(self, nums): """ :type nums: List[int] :rtype: int """ cur_sum = 0 max_sum = nums[0] for n in nums : cur_sum += n max_sum = max(cur_sum, max_sum) if cur_sum < 0 : cur_sum = 0 return max_sum
나의 풀이