[LeetCode] 53. Maximum Subarray
Python
class Solution:
def maxSubArray(self, nums: List[int]) -> int:
answer = -sys.maxsize
sum_num = 0
for num in nums:
sum_num = max(num, num + sum_num)
answer = max(answer, sum_num)
return answer
댓글남기기