Hey guys, I was trying a brute force solution for this problem. My problem is that I am getting NZEC error and am unable to figure out why.

My solution-

Algorithm- Pretty much brute forced, except that I am storing the result in an array mp[dish_no.][index_of_ingredient]

I think its somewhere in the recursion but am not able to generate any test case for that. Can anyone please help? :slight_smile:

Probably it’s entering in an infinite loop leading to stack overflow or access violation.

You might want to explain your overall approach as a DP approach is hard to understand looking at the code.