When i did this question with recursion with memoization TLE occured.But when i did it with tabulation method it got accepeted in 0.00 time.
How can there be so much difference in both the approaches one giving 0 seconds time and other more than 5 seconds.
Is recursive approach with memoization so bad then why we are taught that.
Plz help me in clearing my concepts.
Solution of recursion with memoization- https://ideone.com/0zy0gj