Beats 91.51% || Maximum product difference between two pairs
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n-Sort the array - use r
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n-Sort the array - use reverse it will sort in reverse order\n-nums[0] gives the first element\n-nums[1] gives the second element\n-nums[-2] gives the second last element\n-nums[-1] gives the last element\n-return there product difference.\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```\nclass Solution:\n    def maxProductDifference(self, nums: List[int]) -> int:\n        nums.sort(reverse=True)\n        print(nums)\n        return nums[0]*nums[1]-nums[-2]*nums[-1]\n```
['Python3']