Intro: As far as I could search, this question wasn\'t asked in SO yet.
This is an interview question.
I am not even specifically looking for a code sol
Find the second smallest that is not a neighbour of the first one and not the first or last one in the array. Then build the sum.
Otherwise calculate the sum of both neighbours of the first number. check if its smaller then the first sum
This will always work because if the first sum is not the answer that means the first number cannot be part of the solution. And that on the other hand means, the solution can just be the second sum.