Not passing the last test case showing MLE error
@manikjindal49 you have to solve this problem in O(1) complexity so you can directly solve this by fibonacci.
constraints are large this is the reason you are getting error on submission.
the memory constraints for this problem is high.
try to do this in O(1) space (as we do for fibonnaci) i.e use three variable .
use 2 of them to store last two states answers and 3rd to store current state answer.
check this code:
https://ide.codingblocks.com/s/420469
i am not able to check by submitting this code:
please check if this code is passing cases or not?
No last test case is not passing
Help as still my test cases are not passing by both the methods
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.