I am sharing my code URL. Please look into it
Not passing all test cases in Book Store problem
Your memset should be done in main function. As whenever a recursive call goes, all the indexes become -1 , also those which have been already been calculated by us. Check it if this works. As I don’t have access to this question. I can’t check it manually.
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.