C++ 0ms Solution using priority queue
\n# Code\n\nclass Solution {\npublic:\n    int maxProduct(vector<int>& nums) {\n        priority_queue<pair<int,int>> pq;\n        for(int i=0;i<nums.size();i++
\n# Code\n```\nclass Solution {\npublic:\n    int maxProduct(vector<int>& nums) {\n        priority_queue<pair<int,int>> pq;\n        for(int i=0;i<nums.size();i++)\n        {\n            pq.push({nums[i],i});\n        }\n        int a = pq.top().first;\n        pq.pop();\n        int b =pq.top().first;\n        int ans = (a-1)*(b-1);\n        return ans;\n    }\n};\n```
['Array', 'Sorting', 'Heap (Priority Queue)', 'C++']