Company: Cohesity_28aug
Difficulty: medium
Greatest Product of Two Elements in Array Problem Description Given an array a , find the greatest number in a that is a product of two elements in a . If there are no two elements in a that can be multiplied to produce another element contained in a , return -1. Examples Example 1: Input: a = [10, 3, 5, 10, 15] Output: 30 Explanation: 30 is a product of 10 and 3. Example 2: Input: a = [2, 3, 7, 8] Output: -1 Example 3: Input: a = [10, 2, 4, 30, 35] Output: -1 Example 4: Input: a = [10, 2, 2, 4, 30, 35] Output: 4 Explanation: 4 is a product of 2 and 2. Constraints 1 <= a.length <= 10^3 1 <= a[i] <= 10^9 ```