Why is this code giving me TLE?

Solution. I know why a TLE occurs but I think my code is quite efficient over here as I have memoized it!

Well no one answered it… Just in case anyone needs it-> The reason was I was setting up my dp table as 0 and the possibility that the answer will be zero is high… Hence it recomputed even if the answer was computed once… So preset the dp table with a better value :slight_smile: