Skip to content

Commit 2722d52

Browse files
data structure
1 parent d0b2153 commit 2722d52

3 files changed

Lines changed: 109 additions & 75 deletions

File tree

.idea/workspace.xml

Lines changed: 60 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Target Offer/连续子数组的最大和.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ def FindGreatestSumOfSubArray2(self, array):
3030
for i in range(len(array)):
3131
if i == 0 or aList[i-1] <= 0:
3232
aList[i] = array[i]
33-
elif i !=0 and aList[i-1] >0:
33+
elif i != 0 and aList[i-1] > 0:
3434
aList[i] = aList[i-1] + array[i]
3535
return max(aList)
3636

3737

3838

39-
alist = [6, -3, -2, 7, -15, 1, 2, 2]
39+
alist = [1, -2, 3, 10, -4, 7, 2, -5]
4040
s = Solution()
4141
print(s.FindGreatestSumOfSubArray2(alist))

0 commit comments

Comments
 (0)