Question- https://www.spoj.com/problems/ACPC10D/ My Solution- https://ideone.com/Ulz55t I did this question by using concept of dynamic programming recursion with memoization. But it is showing time limit exceeded.
Plz help me! What changes should i do in my program?
How long does it take to run when there are 100000 rows?
How would i know that, i can’t enter this much rows. But if that’s the reason what optimization should i do with my code or should i change my code fully?
You should choose second option of course.
Why not? Then maybe 50000 rows, half of that or half of half?
I did it with other way analyzing it from top to bottom . BTW i want to know if recursion with memoization is slower than loop approach in dynamic programming?
You’ve tried it both ways, one was AC, and the other TLE, so now you have your answer.
Were you also expecting to be able to recurse to a depth of 100000?
yes i was . But after getting TLE i realized i shouldn’t have expected that.