CodePudding user response:
Arrange an array by size, take the first and second number multiplication is the smallestCodePudding user response:
Here only ideas, regardless of the multiplication int beyond the scope of theIn turn over the array elements, to determine N - whether the current element in the array also exist (guarantee and for N), if there is a product of the calculation, and save the minimum product
Int min=Integer. MAX_VALUE;//minimum product initial value
for (int i=0; i
If (tmp>=0) {
//if N - a [I] in the array, and the two Numbers multiplied
If (independence idx!=1 & amp; & Independence idx!=I & amp; & (TMP=a [I] * TMP) & lt; Min) {
Min=TMP;//save the latest min
}
}
}
System. The out. Println (min);