Place tiles problem 1D

Sir I implemented modular matrix exponentiation as I got general term for the answer as n+1 th fibonacci number to get the answer, still unable to pass two test cases.

Are you solving it by declaring dp[] array?

I have used matrix exponentiation, rest is all commented part which I tried earlier

There’s a memory constraint in this problem so try to solve it in o(1) space and if this doesn’t work, send me your code I’ll update it.

Actually it is showing Wrong answer instead of MLE. So I think it is case with wrong answer. I am sharing the code.

You are having doubt in place the tile problem? If it’s yes then it is a simple fib problem and not what you actually did.

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.