- URL : https://leetcode.com/problems/product-of-array-except-self/description/
- points from constraints
  - 2 <= nums.length <= 10^5
    - if not use O(n) algorithm, a TLE occurs
  - -30 <= nums[i] <= 30
    - the production result can be negative
    - do not use an unsigned type for the result object.
  - The input is generated such that answer[i] is guaranteed to fit in a 32-bit integer.
    - There is no need to use a 64-bit (or larger) type for the result object.
    - However, it is not guaranteed that the intermediate object will always be a 32-bit type.



```cpp
class Solution {
public:
    vector<int> productExceptSelf(vector<int>& nums) {
        vector<int> idxOfZero;
        long long productRes = 1;
        for(int i=0;i<nums.size();i++){
            if(nums[i]==0){
                idxOfZero.push_back(i);
            }else{
                productRes *=nums[i];
            }
        }
        vector<int> res(nums.size(), 0);
        if(idxOfZero.size()>=2){
            return res;
        }else if(idxOfZero.size()==1){
            res[idxOfZero[0]] = productRes;
            return res;
        }

        for(int i=0;i<nums.size();i++){
            res[i] = (int)(productRes / nums[i]);
        }
        return res;
    }
};
```

- O(n)
- long long type for result object -> 64bit(by constraint #3)



