Tap here to switch tabs
Problem
Submissions

Problem: Maximum Product Difference Between Two Pairs

med
30 min
Try to solve the Maximum Product Difference Between Two Pairs problem.

Statement

Given an integer array nums, choose 44 distinct indices w, x, y, and z such that the product difference between pair (nums[w], nums[x]) and pair (nums[y], nums[z]) is maximized.

The product difference between two pairs (a,b)(a, b) and (c,d)(c, d) is defined as (a⋅b)−(c⋅d)(a \cdot b) - (c \cdot d).

Return the maximum possible product difference.

Constraints:

  • 4≤4 \leq nums.length ≤104\leq 10^4

  • 1≤1 \leq nums[i] ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Product Difference Between Two Pairs

med
30 min
Try to solve the Maximum Product Difference Between Two Pairs problem.

Statement

Given an integer array nums, choose 44 distinct indices w, x, y, and z such that the product difference between pair (nums[w], nums[x]) and pair (nums[y], nums[z]) is maximized.

The product difference between two pairs (a,b)(a, b) and (c,d)(c, d) is defined as (a⋅b)−(c⋅d)(a \cdot b) - (c \cdot d).

Return the maximum possible product difference.

Constraints:

  • 4≤4 \leq nums.length ≤104\leq 10^4

  • 1≤1 \leq nums[i] ≤104\leq 10^4