Last active
December 11, 2017 18:02
-
-
Save proustibat/d93c529685b31a5f7a19e6d54649c71a to your computer and use it in GitHub Desktop.
Given an array of integers, find the pair of adjacent elements that has the largest product and return that product.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const adjacentElementsProduct = arr => Math.max( ...arr.slice( 1 ).map( ( n, i ) => n * arr[ i ] ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment