How can we find print the elements of the Maximum Sub-array using KAdane’s Algorithm?
Kadene's Algorithm
Hi Shivam, the idea is to use two pointers - start and end,
initialize both to 0 and update start when sum<0, similarly update end when maxsum<sum.
Code for reference:
On input -> 0 0 0 3 it is showing maximum sunarray as -> 0 0 0 3. But it should be showing -> 3
The input array size is 4
this is also correct!
Your code is not working on every case