Answer the question
In order to leave comments, you need to log in
Can you translate the text of the task?
I'm solving problems in English and then this task appeared.
Given an array of integers, find the pair of adjacent elements that has the largest product and return that product.
For inputArray = [3, 6, -2, -5, 7, 3], the output should be
adjacentElementsProduct(inputArray) = 21.
7 and 3 produce the largest product.
I thought to find the 2 largest numbers in the array and multiply each other, but in this scenario, if I am given an array [5, 1, 2, 3, 1, 4], the answer is 20 and should be 6.
I do not need an answer to the problem , I just want to understand what the essence of the problem is in order to solve it myself.
Answer the question
In order to leave comments, you need to log in
Find the pair of adjacent elements with the largest product and return that product.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question