The less value c(a) is, the more beautiful the array is.
It’s time to change the world and Levko is going to change his array for the better. To be exact, Levko wants to change the values of at most k array elements (it is allowed to replace the values by any integers). Of course, the changes should make the array as beautiful as possible.
给出一个长度为 n的序列 a,可以修改不超过 k个元素的值,
你需要最小化max|a[i] – a[i-1]|
5 2 4 7 4 7 4
0
3 1 -100 0 100
100
6 3 1 2 3 7 8 9
1