class Solution {
public:
vector<int> multiply(const vector<int>& A) {
vector<int> result;
if(A.size() == 0)
return result;
result.push_back(1);
int temp = 1;
for(int i = 1; i < A.size(); i++){
temp *= A[i-1];
result.push_back(temp);
}
temp = 1;
for(int i = A.size() - 2; i >= 0; i--){
temp *= A[i+1];
result[i] *= temp;
}
return result;
}
};