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
▲ Console
📱

Install Talent Enrich

Get instant access to jobs and career tools on your device.