C++ 3 Solutions: Max_Heap, Linear Scan, Sort
FIRST\n\nclass Solution {\npublic:\n    int maxProduct(vector<int>& nums) {\n        priority_queue<int, vector<int>, greater<int>> que;\n        \n        for(
FIRST\n```\nclass Solution {\npublic:\n    int maxProduct(vector<int>& nums) {\n        priority_queue<int, vector<int>, greater<int>> que;\n        \n        for(int i = 0; i < (int)nums.size(); ++i){\n            if(que.size() < 2) { que.push(nums[i]); continue; }\n            \n            if(que.top() < nums[i]){\n                que.pop();\n                que.push(nums[i]);\n            }\n        }\n        \n        int temp = que.top() - 1; que.pop();\n        \n        return ((que.top() - 1) * temp);\n    }\n};\n```\n\nSECOND\n```\nclass Solution {\npublic:\n    int maxProduct(vector<int>& nums) {\n        sort(nums.begin(), nums.end());\n        \n        return (nums[nums.size() - 1] - 1) * (nums[nums.size() - 2] - 1);\n    }\n};\n```\n\nTHIRD\n```\nclass Solution {\npublic:\n    int maxProduct(vector<int>& nums) {\n        int highest = 0, highest_two = 0, max_index = 0;\n        \n        for(int i = 0; i < (int)nums.size(); ++i){\n            if(nums[i] > highest) { highest = nums[i]; max_index = i; }\n        }\n        \n        for(int i = 0; i < (int)nums.size(); ++i){\n            if(nums[i] > highest_two && max_index != i ) highest_two = nums[i];\n        }\n        \n        return (highest - 1) * (highest_two - 1);\n    }\n};\n```
['C', 'Sorting', 'Heap (Priority Queue)', 'C++']