find max y=max erase this from vec z=max from the new vec baad mein y*z return :D
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```cpp []\nclass Solution {\npublic:\n    int maxProduct(vector<int>& nums) {\n        auto max_it=max_element(nums.begin(),nums.end());\nint y=*max_it-1;\nint max_index=distance(nums.begin(),max_it);\n\n        nums.erase(nums.begin()+max_index);\n        max_it=max_element(nums.begin(),nums.end());\n        int z=*max_it-1;\n\n        return y*z;\n\n   \n    }\n};\n```
['C++']