How to print subarray having max sum?

In this method(Kadane’s) to find the max sum of the subarray, how to find and print that subarray. Will it not increase the complexity, if we use 2 loops?

to print subarray having max sum you can make two extra variable s and e (they store starting and ending index of subarray respectively)

one loop is require to print the subarray
if you want to print then you have to compromise with time

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.