Practice Maximum Product Difference Between Two Pairs
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
The product difference between two pairs (a, b) and (c, d) is defined as (a * b) - (c * d). Given an integer array nums, choose four distinct indices w, x, y, and z such that the product difference between pairs (nums[w], nums[x]) and (nums[y], nums[z]) is maximized. Return the maximum such product difference.
Source: Maximum Product Difference Between Two Pairs on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
nums = [5,6,2,7,4]
34
# Example 2
nums = [4,2,5,9,7,4,8]
64
Constraints
Related LeetCode Problems
Practice more problems similar to Maximum Product Difference Between Two Pairs.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.