I’ve tried the DP approach for the problem still it shows run error. I find the largest value of fibonacci number to be found and store all fibonacci numbers till n. And then just simply access the array to print the element. I don’t get why it’s showing runtime error.
Run-error using dp
Hy @mayukh
The problem fast fibonacci has large constraints which are not satisfied by a Dynamic programming solution.
You need to you the approach of Matrix Exponentiation in order to solve the recurrence of the fibonacci in the given constraint limit.
Thanks And Regards
Sanket