diff --git a/1913_Maximum_Product_Difference_Between_Two_Pairs.java b/1913_Maximum_Product_Difference_Between_Two_Pairs.java new file mode 100644 index 0000000..2eed4a0 --- /dev/null +++ b/1913_Maximum_Product_Difference_Between_Two_Pairs.java @@ -0,0 +1,11 @@ +// id: 1913 +// Name: Maximum Product Difference Between Two Pairs +// link: https://leetcode.com/problems/maximum-product-difference-between-two-pairs/ +// Difficulty: Easy + +class Solution { + public int maxProductDifference(int[] nums) { + Arrays.sort(nums); + return (nums[nums.length-1]*nums[nums.length-2]) - (nums[0]*nums[1]); + } +}