Kadanes algo isnt running
there were couple of small mistakes in your code
- instead of adding a[k] you were adding a[i] to cumsum
- size of the array a was small
Corrected Code with comments:
there were couple of small mistakes in your code
Corrected Code with comments: