Please provide the solution for both the Question Ladder and above with matrix exponentiation

i am not very clear with how to write the code . please provide code soln and explain it

Hello @adityaverma3471,

Following are the possible ways to approach this problem:

Hope, this would help.

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.