Write a program to find the odd man out in multiply and add pair series. Assume that the multipliers and the numbers added are in the range -10 to 10.
Input (int[]) | Output (int) |
---|---|
{74, 224, 447, 1345, 2685, 8057, 16113} | 1345 |
{20, 71, 141, 425, 849, 2549} | 20 |
{6, 20, 39, 119, 235, 713, 1425, 4277} | 235 |
{1, 8, 15, 47, 93, 281, 561, 1685} | 1 |
{2, -4, -6, -28, -31, -100, -102, -316} | -31 |
{10, 10, 9, 9, 8, 8, 7, 12, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1} | 12 |
{9, 29, 57, 177, 345, 1037, 2073, 6221} | 177 |
{2, -4, 33, 89, -618, -1865, 13053, 39149} | -1865 |
class OddManOutInMultiplyAndAddPairSeries
{ public static void main(String s[])
{
int input[] = {6, 20, 39, 119, 235, 713, 1425, 4277};
System.out.println("The odd man is : " + findOddManOut(input));
}
public static int findOddManOut(int[] series) {
//Write code here to find the odd man out from the given series and return it
}
//If required, write any additional methods here
}
Topic: Learn Arrays And Loops