Problem Description
You are given an array A containing N integers. The special product of each ith integer in this array is defined as the product of the following:
Write a program to find the maximum special product of any integer in the array. In other words you have to find the maximum for all i (0<i<n-1) of product of l and r such that l is the LeftSpecialValue and r is the RightSpecialValue of an index i.
Note that the array A is zero indexed.
NOTE: As the answer can be large, output your answer modulo 109 + 7.
1 <= N <= 105
1 <= A[i] <= 109
First and only argument is an integer array A.
Return an integer denoting the maximum special product of any integer.
Input 1:
A = [1, 4, 3, 4]
Input 2:
A = [10, 7, 100]
Output 1:
3
Output 2:
0
Explanation 1:
For A[2] = 3, LeftSpecialValue is 1 and RightSpecialValue is 3. So, the ans is 1*3 = 3.
Explanation 2:
There is not any integer having maximum special product > 0. So, the ans is 0.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.