We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 067586b commit b01cadeCopy full SHA for b01cade
1913-maximum-product-difference-between-two-pairs.js
@@ -0,0 +1,9 @@
1
+/**
2
+ * @param {number[]} nums
3
+ * @return {number}
4
+ */
5
+const maxProductDifference = function(nums) {
6
+ nums.sort((a, b) => a - b)
7
+ const n = nums.length
8
+ return nums[n - 1] * nums[n - 2] - nums[0] * nums[1]
9
+};
0 commit comments