Simple and Easy to understand | 3 Lines Code | Java | C++
 # Intuition  \n\n\n# Approach\n- Sort the array to identify the two maximum and two minimum numbers.\n- Calculate and return the maximum difference between the
<!-- # Intuition -->\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n- Sort the array to identify the two maximum and two minimum numbers.\n- Calculate and return the maximum difference between the product of the two largest numbers and the product of the two smallest numbers.\n\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:  $$O(nlogn)$$ <-- for sorting array\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$ <-- we use constant space\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```Java []\nclass Solution {\n    public int maxProductDifference(int[] nums) {\n        int n = nums.length;\n        Arrays.sort(nums);\n        return (nums[n-1]*nums[n-2]) - (nums[0]*nums[1]);\n    }\n}\n```\n```C++ []\nclass Solution {\npublic:\n    int maxProductDifference(std::vector<int>& nums) {\n        int n = nums.size();\n        std::sort(nums.begin(), nums.end());\n        return (nums[n - 1] * nums[n - 2]) - (nums[0] * nums[1]);\n    }\n};\n```\n\n\n```\nIf you like please UpVote the solution. \n```
['Array', 'Sorting', 'C++', 'Java']