Computer Science, asked by ArishaRazi732, 1 year ago

Kevin has a sequence of integers a1, a2, ..., an. Define the strength of the sequence to be |a1 - a2| + |a2 - a3| + ... + |an-1 - an| + |an - a1|. Kevin wants to make his sequence stronger, so he reorders his sequence into a new sequence b1, b2, ..., bn. He wants this new sequence to be as strong as possible. What is the largest possible strength of the resulting sequence?

Answers

Answered by Anonymous
0
a5=31a5=31;


a4=31−5=26a4=31−5=26;



a3=26−5=21a3=26−5=21;



a2=21−5=16a2=21−5=16;


a1=16−5=1a1=16−5=1.


[tex]**************************** [/tex]
Answered by Raghav3333
3
a5=31a5=31;


a4=31−5=26a4=31−5=26;



a3=26−5=21a3=26−5=21;



a2=21−5=16a2=21−5=16;


a1=16−5=1a1=16−5=1.


Similar questions