Beats 100% in Runtime
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```javascript []\n/**\n * @param {number[]} nums\n * @return {number}\n */\nvar maxProduct = function(nums) {\n    nums.sort((a, b) => (b - a));\n    return (nums[0]-1)*(nums[1]-1);\n};\n```\n```cpp []\nclass Solution {\npublic:\n    int maxProduct(vector<int>& nums) {\n        sort(nums.begin(), nums.end());\n        reverse(nums.begin(), nums.end());\n        return (nums[0]-1)*(nums[1]-1);\n    }\n};\n```\n\n
['C++', 'JavaScript']