Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

I need an approach to solve this question.

Правка en1, от tusharjape007, 2019-01-26 16:18:38

I recently encountered a question on a contest organised by CodeNation which is as follows.

You have been give an array comprising of numbers (ranging from -10^9 to +10^9) and the value of an array is defined as the sum of the absolute differences between each pair of consecutive entries in the array. You are allowed to reverse a contiguous subarray of the given array. What would be the maximum possible value of the array if you apply the given operation utmost once?

I am stuck on the O(n^2) approach to this problem. Can anyone please help me out?

Теги array

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский tusharjape007 2019-01-26 16:18:38 602 Initial revision (published)