Unfortunately, the only operation available for even numbers is to divide by two, so you wouldn't be able to multiply the first element 2 by two to get 4.
That makes the optimal result [2,5,4] or [2,5,2].
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
shouldn't the 3rd example in the question be 1 ? as the array will be [4,5,4]
Unfortunately, the only operation available for even numbers is to divide by two, so you wouldn't be able to multiply the first element
2
by two to get4
.That makes the optimal result
[2,5,4]
or[2,5,2]
.