Could someone please explain what is wrong with this recursive sol:

The logic is that everyday the person has a choice to choose that day or not until the number of rest days is 3 and we return the min of both ,then he/she is forced to choose that day.

if(rest==3){

cost=supw[idx]+solve(idx-1,0)

}

else{

cost=min(solve(idx-1,rest+1),solve(idx-1,0)+supw[idx])

}