Given a sequence X of length N.
Generate two sequence Y and Z of length N such that:
Output the minimum value of | Y[1] | + ... + | Y[N] | + | Z[1] | + ... + | Z[N] |.
Example :
Input :
3 // N
1 -2 3 // X[]
Output :
10
(Taking Y=[0, 0, 5] and Z=[1,-2,-2])
Can someone tell how to solve this question?