Page 1 of 1

please i need the "full answer" as soon as possible as i posted here many times with no answer please can the code be wi

Posted: Fri May 20, 2022 11:29 am
by answerhappygod
please i need the "full answer" as soon as possible as i posted
here many times with no answer
please can the code be with java , c++ or python. the problem is
:
you are given a sequence of n integers a1,a2,..an. you are also
given x integers 1,2,...,x.
you are asked to insert the integers in x into the sequence a.
each integer can be inserted at the beginning of the sequence , at
the end of the sequence or between any elements of the sequence
the score of the resulting sequence a' is the sum of the
absolute differences of the adjacent elements in it.
what is the smallest possible score of te resulting sequence a'
show the new sequence and the result
example:
a' = 7,7,6,4,2,2,1,3,5,8,10
result = 15
test your code with
x = 2
A= 6 1 5 7 3 3 9 10 10 1
And
X = 10
A = 1 3 1 2