Pages

Java Challenge - 1

Java Challenge - 1

     Welcome to newly event of my website! If you want to prove you are a JAVA PROFESSIONAL, here is chance for that. Gear up , find solution, Test the solution and beat the challenge! Best solution will display on the web site!


Given an array of integers, find the pair of adjacent elements that has the largest product and return that product.

Example

For inputArray = [3, 6, -2, -5, 7, 3], the output should be
adjacentElementsProduct(inputArray) = 21.

7 and 3 produce the largest product.

    Test Materials 
                                                                        OUTPUTS
        int[]arr1 = {3,6,-2,-5,7,3};                       21
        int[]arr2 = {-1,-2};                                     2
        int[]arr3 = {5, 1, 2, 3, 1, 4};                     6
        int[]arr4 = {1, 2, 3, 0};                            
        int[]arr5 = {9, 5, 10, 2, 24, -1, -48};       50 
        int[]arr6 = {5, 6, -4, 2, 3, 2, -23};           30
        int[]arr7 = {4, 1, 2, 3, 1, 5};                     6
        int[]arr8 = {-23, 4, -3, 8, -12};              -12

UPLOAD YOUR SOLUTION : Upload only Text File

Need HELP!!!???



Aricle By : Nisal Priyanka