What is wring in this code

failed test cases are :- 9,15,21.
def multiply_optimized(poly1,poly2):
if not poly1 or poly2:
return []

``````if len(poly1) == 1:
if poly1[0] == 0:
return [0]
else:
return [poly1[0]* x for x in poly2]

elif len(poly2) == 1:
if poly2[0] == 0:
return [0]
else:
return [poly2[0]* y for y in poly1]

(A0,A1),(B0,B1) = split(poly1,poly2)
U = multiply_optimized(A0,B0)
Z = multiply_optimized(A1,B1)
temp = subtract(Y, temp_)
mid = max(len(poly1), len(poly2))
n = mid//2

thanks I reduced the test cases only 9th test case is not passed
Test #1: PASSED
Test #2: PASSED
Test #3: PASSED
Test #4: PASSED
Test #5: PASSED
Test #6: PASSED
Test #7: PASSED
Test #8: PASSED
Test #9: FAILED
Test #10: PASSED
Test #11: PASSED
Test #12: PASSED
Test #13: PASSED
Test #14: PASSED
Test #15: PASSED
Test #16: PASSED
Test #17: PASSED
Test #18: PASSED
Test #19: PASSED
Test #20: PASSED
Test #21: PASSED
Test #22: PASSED
Test #23: PASSED
Test #24: PASSED

subtraction function :-
def subtract(poly1,poly2):
result = [0] * max(len(poly1), len(poly2))
for i in range(len(result)):
if i < len(poly2):
result[i] = poly2[i] - result[i]
if i < len(poly1):
result[i] = poly1[i] - result[i]

``return result``

Yes, I think I mentioned that the code is still giving errors for null lists or lists with `0`,
like `[0], [0,0,0,0], [0,0]`.

The problem would be in this part probably, the recursion calling part and `subtraction` function seems alright