C++ || EASY VECTOR
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass ProductOfNumbers {\npublic:\nvector<int> res;\n    ProductOfNumbers() {\n        res.push_back(1);  \n    }\n    \n    void add(int num) \n    {\n        if(num!=0)\n        {\n            res.push_back(res.back()*num);\n        }\n        else\n        {\n            res.clear();\n            res.push_back(1);\n        }\n    }\n    \n    int getProduct(int k) \n    {\n        if(k>=res.size()) return 0;\n        else\n        return res.back() / res[res.size()-k-1];\n    }\n};\n```
['C++']