Created
March 7, 2020 09:10
-
-
Save deque-blog/618cad148cbaa6c1024dc2646107c622 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def maxSubArray(nums: List[int]) -> int: | |
max_sum = float('-inf') | |
for i in range(len(nums)): | |
cum_sum = 0 | |
for j in range(i, len(nums)): | |
cum_sum += nums[j] | |
if cum_sum > max_sum: | |
max_sum = cum_sum | |
return max_sum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment