### Popular Topics

**How to kadane's algorithm (C++ Programming Language)**

Answer(s) available: 1

1

`def kadane(inputArray):`

2

` maxSum = float(-inf)`

3

` curSum = 0`

4

` `

5

` for x in inputArray:`

6

` curSum = max(0, curSum + x)`

7

` maxSum = max(maxSum, curSum)`

8

` return maxSum`

Source: Code Grepper