题目描述
blablabla
样例
class Solution(object):
def multiply(self, A):
"""
:type A: List[int]
:rtype: List[int]
"""
if not A or len(A) == 0:
return []
tmp = 1
res = []
B = [0 for _ in range(len(A))]
B[0] = 1
for i in range(1, len(A)):
B[i] = B[i - 1] * A[i - 1]
# 得到的是A[0]乘到A[i - 1]
for j in range(len(A) - 2, -1, -1):
tmp *= A[j + 1]
B[j] *= tmp
# 乘上去的是A[n - 1]到A[i + 1]
return B