题解 | #构建乘积数组#
构建乘积数组
https://www.nowcoder.com/practice/94a4d381a68b47b7a8bed86f2975db46?tpId=13&tqId=23445&ru=/exam/oj/ta&qru=/ta/coding-interviews/question-ranking&sourceUrl=%2Fexam%2Foj%2Fta%3Fpage%3D1%26tpId%3D13%26type%3D13
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param A int整型一维数组 # @return int整型一维数组 # class Solution: def multiply(self , A: List[int]) -> List[int]: # write code here L=[] for i in range(len(A)): res=1 for j in range(len(A)): #如果j=i时,不执行乘,跳过 if j!=i: res=res*A[j] else: continue L.append(res) return L