def multiply_optimized(poly1, poly2):

if len(poly1) == 1 :

product = [poly1[0]* poly2[i] for i in range(len(poly2))]

return product

elif len(poly2) == 1 :

product = [poly2[0]* poly1[i] for i in range(len(poly1))]

return product

else:

n = max(len(poly1),len(poly2))

poly1, poly2 = split(poly1, poly2)

```
U = multiply_optimized(poly1[0],poly2[0])
V = multiply_optimized(poly1[0],poly2[1])
W = multiply_optimized(poly1[1],poly2[0])
Z = multiply_optimized(poly1[1],poly2[1])
product = add(U,add(increase_exponent(add(V,W),n//2), increase_exponent(Z,2*(n//2))))
return product
```

1 Like

Well Here you have used the 4 operations method and in the assignment there is given a 3 operations methodâ€¦which further optimises the solutionâ€¦

You can implement this in your solutionâ€¦and this should be fairly easyâ€¦but you may need to create a subtract function to do soâ€¦

If it is clear then Congratulations you have optimised itâ€¦

If it is not clear then I can send you my solution, if you reply so.

Hope this helpsâ€¦

Can you share it I am a bit confused

Thank you

This is how I implemented itâ€¦

If you havenâ€™t implemented the `subtract`

funtion then it is also here,

Sorry for the wrong spelling of **polynomial**

If you are still confused then let me know, Iâ€™ll be happy to helpâ€¦

Hey, I tried your code,but in evaluation it is failing test case 9