MAXIMUM PRODUCT DIFFERENCE BETWEEN 2 PAIRS 🧑🏻‍🤝‍🧑🏿|| PYTHON 🐍 || 2 LINE SOLUTION ! 💯
Intuition\n Describe your first thoughts on how to solve this problem. \nThe need of maximum difference leads towards the path of extreme numbers.\n\n# Approach
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe need of maximum difference leads towards the path of extreme numbers.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nThe approach towards solving this problem could be by sorting the list nums first either in ascending or descending order.\n\n\n**If in ascending order ->**\nSubtract the product of last two elements from nums with the product of first two elements from nums.\n\n**If in descending order ->**\nSubtract the product of first two elements from nums with the product of last two elements from nums.\n\n# Complexity\n- Time complexity: O(nlogn)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n\n- Space complexity: O(1)\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\n        #Sorting nums in descending order\n        nums.sort(reverse=True)\n\n        return (nums[0]*nums[1]) - (nums[-1]*nums[-2]) \n        \n```
['Array', 'Sorting', 'Python3']