Sum of the this sequence This question I tried many times but the answer doesn't 
Come at all. 
It is related with analysis and discrete mathematics.
Here are some natural number $1$ to $20$.
Let the $a_n(1 \le n \le 20)$ 
which is rearrangement of the numer $1 $to $20$.
Find the max of the $\sum_{i=1}^{19} |a_{i} -a_{i+1}|$
Why this answer is 199?

A sequence yielding $199$ is
$$11,1,12,2,13,3,14,4,15,5,16,6,17,7,18,8,19,9,20,10.$$
As to why $199$ is indeed the maximum: It is clear that in every even spot you need a number in $\{1,\ldots,10\}$ while you need a number in $\{11,\ldots,20\}$ in every odd spot to maximize the sum (or vice versa, of course). Hence if the sum would be circular (add $|a_{20} - a_1|$ to the sum), every number in $\{11,\ldots,20\}$ gets added twice and every number in $\{1,\ldots,10\}$ gets subtracted twice. This results in
$$20 \cdot 19 - 2 \cdot 10 \cdot 9 = 200$$
for the circular sum. Making $|a_{20} - a_1|$ smallest possible, i.e. 1, yields a maximum of $199$ for the non-circular sum. So as long as you put $a_1 = 11$ and $a_{20} = 10$ and alternate between large and small numbers, you will always get $199$.
