Skip to content

Commit

Permalink
Merge pull request #183 from adarshraghav/master
Browse files Browse the repository at this point in the history
Kadane's Algorithm
  • Loading branch information
fineanmol committed Oct 1, 2021
2 parents fc6587d + c440201 commit 87f455f
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
def maxSubArraySum(arr,size):

max_till_now = arr[0]
max_ending = 0

for i in range(0, size):
max_ending = max_ending + arr[i]
if max_ending < 0:
max_ending = 0


elif (max_till_now < max_ending):
max_till_now = max_ending

return max_till_now

0 comments on commit 87f455f

Please sign in to comment.