Snippets Collections
class StrongestNeighbour{
    
    // Function to find maximum for every adjacent pairs in the array.
    static void maximumAdjacent(int sizeOfArray, int arr[])
    {
        int sum=0;
        for(int i=0; i<sizeOfArray-1; i++)
        {
            sum = Math.max(arr[i], arr[i+1]);  
            System.out.print(sum+" ");
            
        }
    }
}
star

Tue Feb 08 2022 06:22:48 GMT+0000 (Coordinated Universal Time) https://practice.geeksforgeeks.org/problems/strongest-neighbour/1/?track=DSASP-Arrays&batchId=190

#java #gfg #geeksforgeeks #arrays #practice #strongestneighbour

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension