Java | 2 liner | Easy to Understand | for Beginners | 0 ms | fast💡
Approach\n- using quicksort to sort nums\n- returning [last element - 1] * [second last element - 1]\n\n# Complexity\n- Time complexity: O(n log n)\n\n- Space c
# Approach\n- using quicksort to sort nums\n- returning [last element - 1] * [second last element - 1]\n\n# Complexity\n- Time complexity: O(n log n)\n\n- Space complexity: O(log n)\n\n# Code\n```\nclass Solution {\n    public int maxProduct(int[] nums) {\n        Arrays.sort(nums);\n        return (nums[nums.length-1]-1)*(nums[nums.length-2]-1);\n    }\n}\n```\n\n![images.jpeg](https://assets.leetcode.com/users/images/7cfc0759-ab49-4b1d-a9ad-62f234ffca1e_1682140281.1317298.jpeg)\n
['Array', 'Sorting', 'Java']