Day 10 is finding the biggest adjacent element of product in an array.
For example an array [3,6,-2,-5,7,3]
the output should be 21
because 7*3=21
is the biggest adjcent product in an array.
This is JavaScript solution
function adjacentElementsProduct(nums) { let biggest = 0; for (let i = 0; i < nums.length; i++) { if(biggest < nums[i]*nums[i+1]) { biggest = nums[i]*nums[i+1]; } } return biggest; }
Top comments (0)