i tried the recursive approach first but its giving 30 for below input it should give 40
6
30 10 60 10 60 50
I was solving this Problem https://atcoder.jp/contests/dp/tasks/dp_a
@chemant077
take a simpler case
3
30 10 60
you shd get the ans 30 for |60-30| but u are getting 20.that is because when u go for op1 it gives u abs( 30-10 ) + f(v, 1, n)
and when u call the function f(v,1,n)