Skip to content

Commit

Permalink
Create 1913_Maximum_Product_Difference_Between_Two_Pairs.java
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhuzaima committed Dec 18, 2023
1 parent 2c6fee7 commit 2f51714
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions 1913_Maximum_Product_Difference_Between_Two_Pairs.java
Original file line number Diff line number Diff line change
@@ -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]);
}
}

0 comments on commit 2f51714

Please sign in to comment.