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+" "); } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter