Sir how can I print the sub array in this which has the maximum sum. Will it be similar to the previous algos,I have tried them but unable to print the sub array.
Max array in Kadane's algo
@rizvibilal10
Just maintain a start pointer, and update it as soon the running sum becomes negative. because that would indicate the start of new subarray.
But sir how to print that subarray.
I have printed the maximum sum but unable to print that array which has the max sum.
You will have the start of the array and the maximum sum, just start printing from start till the maximum sum is not achieved.