Having problem in framing recursive soln

How will recursive func be? suppose it accepts 3 arguments array,starting index,end index
so should be like i have to keep updating starting and ending and pass into the function?

Hello @pranjalarora98yes you have to keep in updating the parameters otherwise it will lead to TLE .

See something like this?

whenever it becmes equal then i have to discard one and use other? how to know which to discard

Hello @pranjalarora98 please wait let me see your logic then only i can tell.

@pranjalarora98 could you explain your logic?

I have made a function which will take 3 arguments array,starting index and end index and sum ok?
now i will start from starting index and start calculating sum and whenever it becomes equal to left and right…something like this?

Hello @pranjalarora98 yes this is fine.but how you are thinking of moving further as you have to further also divide it in half and do the same on it as well.

if i pass into new array and new indexes

i mean new indexes into the function?

@pranjalarora98 i didnt get you.

how should i proceed with that function further any hints?

hey @pranjalarora98 you can see this code:


if you have any doubt you can ask here:
Happy Learning!!

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.