Please read the new rule regarding the restriction on the use of AI tools. ×

innoshark's blog

By innoshark, history, 5 years ago, In English

Hello, I was just attempting this questionhere and solved it by writing out this code here. However, my original thoughts on this question, were to write out a normal dp and then optimize it using matrix exponentiation, and then do binary search on all values of n. However, I got confused and I did not know how to do the optimization. Can someone please explain to me how this could be done?

  • Vote: I like it
  • 0
  • Vote: I do not like it