A simple two-line solution with a step-by-step process.
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n1. Sort the array from larger to small\n2. Took 0,1 index values from tha
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n1. Sort the array from larger to small\n2. Took 0,1 index values from that array ( since after sort they are the largest or same)\n3. calculate the anser and return ind\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```typescript []\nfunction maxProduct(nums: number[]): number {\n\n    //sort values from larger to small\n     nums.sort((a,b) => b-a);\n    //Calculating and returning the first two values.\n    return ( (nums[0]-1)* (nums[1]-1) );\n    \n};\n```
['TypeScript', 'JavaScript']