E
E
Evgeniy2021-01-25 12:08:29
Programming
Evgeniy, 2021-01-25 12:08:29

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

2 answer(s)
R
Rsa97, 2021-01-25
@Evdokim001

Find the pair of adjacent elements with the largest product and return that product.

F
Flysink, 2021-01-25
@Flysink

Your pair of elements is 5.1 - 2.3 - 1.4 which of these pairs has the sum of the others?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question