In the SPP problem, logic i used was to create a transformation matrix like {{0 ,1,0…0},{0,0,1,0…0},…{Cn,Cn-1…C1,0},{Cn,Cn-1,…C1,1}}, this way you get sum of the previous values as last element of column matrix. Then i am just taking difference of these and printing result. Not sure what is wrong
Not sure if transformation matrix is wrong
Hi
transformation matrix would be
and then calculating the nth and mth term and then subtract.
be careful with the matrix c1 multiplied with an-1
post image of your matrix
Here is the image of matrix that i am using.
This passes all test cases of FIBOSUM, and all but first test case of SPP. Approach is to get Sm-1 and Sn, difference of which gives the required sum. All but first test case has an issue , not sure what am I skipping here.
Hi
are making the size pf matrix k*k ?
Post Link of your code also so that i can see
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.