3 functions idea

i was trying to solve the buying fruit problem then i was thinking if i could divide in three different functions and write

arr1[]={1,50,50},arr2[]={50,50,50},arr3[]={1,50,50}

func1(int i,int n,int* arr1)
{
min(arr1[i]+func2(i+1,n,arr2)+func3(i,n,arr3))

}

func2(int i,int n,int* arr2)

{

min(arr2[i]+func3(i+1,n,arr3))

}

func3(int i,int n,int* arr3)

{

min(arr3[i])

}
i have not wriiten the base cases but will this work?

@neha_153 hey instead of three functions use 1 and use recursion.

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.