A clear c++ solution in O(n) time and O(1) space without division, but it's slow,hope some suggestions

```
public:
vector<int> productExceptSelf(vector<int>& nums) {
int size = (int)nums.size();
vector<int> output(size,1);
/* calculate left product */
int left_product = 1;
for (int i=1;i<size;i++) {
left_product *= nums[i-1];
output[i] *= left_product;
}
/* calculate right product */
int right_product = 1;
for (int i=size-2;i>=0;i--) {
right_product *= nums[i+1];
output[i] *= right_product;
}
return output;
}
};
```