FibonacciMeetGCD Problem

I got Green when submitted on Hackerblocks but got TLE in one Test case on HackerEarth. How can i optimise it.
My Solution-https://ide.codingblocks.com/s/70960

Hi

just pass matrix in function mul by reference ( when you pass again and again matrix this takes time and sometime you get TLE, so a good practice is whenever changes does not matter pass it by reference)

Hit like if you get it!
Cheers!

Sir, Sorry but i am not able to make changes that you are talking about.I am getting some weird compilation errors. Could you please modify my code.

Solution Link-https://ide.codingblocks.com/s/70960

Hi

just do this pass matrix A by reference ( add a “&” )
image

Hit like if you get it!
Cheers!

1 Like