Skip to content

Latest commit

 

History

History
32 lines (19 loc) · 866 Bytes

File metadata and controls

32 lines (19 loc) · 866 Bytes

Adjacent Elements Product

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.

Input/Output:

  • [execution time limit] 5 seconds (ts)

  • [input] array.integer inputArray

    • An array of integers containing at least two elements.
    • Guaranteed constraints:
      • $2 \le inputArray.length \le 10$
      • $-100 \le inputArray[i] \le 1000$
  • [output] integer

    • The largest product of adjacent elements.

Solution: