simple cpp solution
Runtime: 24 ms, faster than 50.00% of C++ online submissions for Maximum Product of Two Elements in an Array.\nMemory Usage: 10 MB, less than 100.00% of C++ onl
Runtime: 24 ms, faster than 50.00% of C++ online submissions for Maximum Product of Two Elements in an Array.\nMemory Usage: 10 MB, less than 100.00% of C++ online submissions for Maximum Product of Two Elements in an Array.\n```\n    class Solution {\npublic:\n    int maxProduct(vector<int>& nums) {\n        sort(nums.begin(),nums.end());\n        int n = nums.size();\n        return (nums[n-1] -1) * (nums[n-2] - 1);\n    }\n};
['C++']