Tilling problem - 2,compiler gives message asTLE,but the output is correct,please review the code
1 <= T<= 1000
1 <= N,M <= 100000
as constraints are large and this problem includes overlapping subproblems so you have to use dp here.
in question it is also mention that
Print answer for every test case in a new line modulo 10^9+7 .
so data is out of range of int so you have to take long long int instead of int
modified code is
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.