USING PREFIX PRODUCTS C++[99.74% FASTER]
\nclass ProductOfNumbers {\npublic:\n    vector<int>arr;\n    ProductOfNumbers() {\n        \n    }\n    \n    void add(int num) {\n        if(num==0)//CLEAR TH
```\nclass ProductOfNumbers {\npublic:\n    vector<int>arr;\n    ProductOfNumbers() {\n        \n    }\n    \n    void add(int num) {\n        if(num==0)//CLEAR THE VECTOR BECAUSE IT NO LONGER USE;\n        {\n            arr.clear();\n            return;\n        }\n        \n        if(arr.size()>=1)\n        {\n            arr.push_back(arr[arr.size()-1]*num);\n        }\n        else\n        {\n            arr.push_back(num);\n        }\n    }\n    \n    int getProduct(int k) {\n        if(k>arr.size())return 0; //IT MEANS 0 HAS FOUND AND CLEARED THE VECTOR IN ADD METHOD;\n        if(k==arr.size())return arr[arr.size()-1];\n        return arr[arr.size()-1]/arr[arr.size()-(k+1)]; //GET QUOTIENT ;\n    }\n};\n```
[]