题解 | #构建乘积数组# golang
构建乘积数组
http://www.nowcoder.com/practice/94a4d381a68b47b7a8bed86f2975db46
func multiply( A []int ) []int {
// write code here
length := len(A)
answer := make([]int,length)
for i:=0;i<length;i++ {
answer[i]=1
}
for i:=0;i<length;i++ {
for j:=0;j<length;j++ {
if i==j {
continue
} else {
answer[i]*=A[j]
}
}
}
return answer
}