What If We Need To Print The Maximum sum Sub Array?

Kadane’s algorithm prints the maximum sum but what if we need to print the subarray elements that make the maximum sum. Then we need to go to N3 part where we had to make three iterations?

@subham221 if you want to print subarray with maximum sum, you just have to maintain indices in kadane’s algo.
Please take a look at this code for more understanding

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.