if we will put include = exclude = INT_MIN then how we will get correct ans …at the end of video
please explain with a example
if we will put include = exclude = INT_MIN then how we will get correct ans …at the end of video
please explain with a example
You can check it here, you will get correct answer here and why so is because of the base case we have added. For test case:
int weights [] = {5,7,8,4};
int prices [] = {40, 20, 30, 100};
int N = 4;
int C = 3;
here what will happen is nothing will be stored in inc and exc will be calculated every time and a case will come where n is equal to 0, there your answer will be 0 from exc as recursive calls are made. Then maximum of zero and INT_MIN is 0, so your final answer will be 0 only.