Why we using %MOD

why we using dp[i][j] %MOD

Usually in counting problems the answer gets very large and thus out of bound of the range of even long long int, thus to make sure the answer setter stays in bound with affecting the correctness of the solution, the problem setters tell us to print answer % 1000000007.
So here also while storing we do dp[i][j]%Mod

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.