Maximum Product of Two Elements
Easy
Arrays
Array
Sorting
Given array, find max of (nums[i]-1)*(nums[j]-1) for i≠j.
Constraints
2 ≤ len ≤ 500
Examples
Example 1:
Input: 3 4 5 2
Output: 12
Explanation: (4-1)*(5-1)=12
Example 2:
Input: 1 5 4 5
Output: 16
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console