🚀🚀 Beats 100% | 0ms 🔥🔥
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: O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int maxProduct(vector<int>& nums) {\n        ios_base::sync_with_stdio(false);\n        cin.tie(0);\n        cout.tie(0);\n        \n        auto maxi1 = max_element(nums.begin(),nums.end());\n        int index1 = maxi1 - nums.begin();\n        int num1 =  (nums[index1]);\n        num1 = num1 - 1;\n        cout << num1 << endl;\n        nums.erase(nums.begin()+index1);\n        int maxi2 = *max_element(nums.begin(),nums.end());\n        maxi2 = maxi2 - 1;\n        cout << maxi2 << endl;\n        return (num1 * maxi2);\n    }\n};\n```
['Array', 'C', 'Sorting', 'Heap (Priority Queue)', 'Python', 'C++', 'Java', 'Python3', 'JavaScript']