IT_World
[leetcode] 53. Maximum Subarray 본문
class Solution:
def maxSubArray(self, nums: List[int]) -> int:
bstsum = -sys.maxsize
crsum = 0
for num in nums :
crsum = max(num, num + crsum)
bstsum = max(crsum, bstsum)
return bstsum
'Coding test > programmers - single' 카테고리의 다른 글
[leetcode] 22. Generate Parentheses (0) | 2022.03.29 |
---|---|
[leetcode] 67. Add Binary (0) | 2022.03.27 |
[leetcode] 2. Add Two Numbers (1) | 2022.03.24 |
[leetcode] 28. Implement strStr() (0) | 2022.03.24 |
[leetcode] 26. Remove Duplicates from Sorted Array (0) | 2022.03.23 |
Comments