Question - https://hack.codingblocks.com/contests/c/140/1058
Code - https://ide.codingblocks.com/s/90574
So I’m using top down DP to solve this problem.
At first, I was using a 2D array as memo[][] to store my results, but I faced issues with the constraints as n1*n2 < 100000000. I tried different permutations of memo[n1][n2] but I always got a mininum of 2 testcases showing wrong answer (which were different for a different combination of my memo declaration).
Then, I used a 2D vector to do the same, but this time, I’m getting run-error and TLE in many test cases. What am I doing wrong?
PS: Please feel to ask me to explain my question/code more clearly:p