codeforces educational round

help
codeforces
doubt

#1

could anyone suggest a simpler stategy for solving the
problem:http://codeforces.com/contest/863/problem/B


#2

Just brute-force it, since N is very small. (N<= 50)


#3

You can use 2D DP and Sorting.

Here is link to my solution.

At any point, you can choose to find the difference between adjacent numbers or you can leave it.You must remember that you can leave atmost 2 numbers.