All indices problem

how to return the two value one is result array and the second is j the size of the result array. so i can print in main function?

print the answer in the function itself and then return
else if u are willing to pass it to main then create a class with members which u are willing to return
change the return type of function then take it in an object in main then print it ( lengthy process)
1st is preferable

@chhavibansal in the problem itself stated that you have to store the result in the array… so i need to simple cout or store the result?
I have to dry run the code
https://view.ziteboard.com/shared/77526697868513
getting the output in reverse order

Hi @Vikaspal

yr yaha na tum function ke undar array loge to it would not give us the required answer
because for each subsequent call
a new array is make
u can make a global array /vector to store the indices
and take variable j which is returned from the function which would give the size uptil the global array is filled with indeices

i have used vector

@chhavibansal soory for delay, Actually your approach is correct we can make the global array so jb recursion again call hoga tho new array will be created. Can we have the array static so each value only one time assign hogi ?

ha @Vikaspal try kar lo ekh bar chal jayega mere hisab se

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.