// A product of a pair of integers will always be odd if at least 2 of them are odd
class Program {
public static boolean arrayContainsAPairOfOddProduct(int[] arr) {
int sumOdds = 0;
int numberOfOdds = 2;
for (int i = 0; i < arr.length; i++) {
if (arr[i] % 2 != 0) {
if (sumOdds == numberOfOdds) {
return true;
}
sumOdds++;
}
}
if (sumOdds == numberOfOdds) { // for the last array element
return true;
}
return false;
}
public static void main(String[] args) {
int arr[] = new int[] {2, 2, 4, 4, 6, 6, 7, 10, 10, 9}; // 7 * 9 = 63 -> Odd
System.out.println(arrayContainsAPairOfOddProduct(arr));
}
}
/*
run:
true
*/