- 定义C[i] = A[0] * A[1] * ... * A[i-1] , 自上而下的顺序计算出来
- 定义D[i] = A[i+1] * ... * A[n-2] * A[n-1], 自下而上的顺序计算出来
class Solution: def multiply(self, A): # write code here head = [1] tail = [1] for i in range(len(A)-1): head.append(A[i]*head[i]) tail.append(A[-i-1]*tail[i]) return [head[j]*tail[-j-1] for j in range(len(head))]