Find The Common Maximum Number Between Two Arrays - Java Quiz Question


Write a program to get the common maximum number between two arrays.
Assume that the array contains only positive numbers.
It returns -1, when there is no common number

Input(First Array, Second Array) Output
{2, 55, 20, 89, 7, 4}, {95, 23, 2, 7, 55, 17} 55
{11, 2, 56, 45}, {11, 2, 33, 28, 81} 11
{64, 27, 19, 1, 125}, {1, 7, 123, 19, 166, 256} 19
{2, 4, 6, 12, 18}, {3, 5, 9, 21, 23, 25} -1



class CommonMaximumNumber
{
    public static void main(String s[])
    {
        int firstArray[] = {2, 55, 20, 89, 7, 4};
        int secondArray[] = {95, 23, 2, 7, 55, 17};
        int number = getCommonMaximumNumber(firstArray, secondArray);
        System.out.println("The number is " + number);

    }


    public static int getCommonMaximumNumber(int firstSeries[], int secondSeries[])
    {
    }

}