Custom test case displays random answer


this is my code. it passes all test cases except custom test case

Hi @tanjuljain19
There is a problem with the initialisation of the 2d array dp. Try this way : int dp[n+1][c+1];
memset(dp,0,sizeof(dp));
It will work.

Hope it Helps.

Yes this solved the problem but is using dp[n+1][c+1]={0} wrong

Yeah, it is effective to initialise 1d array with 0. But with 2d array, it might or might not prove to be effective.