Skip to content

Commit 2f51714

Browse files
authored
Create 1913_Maximum_Product_Difference_Between_Two_Pairs.java
1 parent 2c6fee7 commit 2f51714

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// id: 1913
2+
// Name: Maximum Product Difference Between Two Pairs
3+
// link: https://leetcode.com/problems/maximum-product-difference-between-two-pairs/
4+
// Difficulty: Easy
5+
6+
class Solution {
7+
public int maxProductDifference(int[] nums) {
8+
Arrays.sort(nums);
9+
return (nums[nums.length-1]*nums[nums.length-2]) - (nums[0]*nums[1]);
10+
}
11+
}

0 commit comments

Comments
 (0)