Score an array by taking the smallest and marking its neighbours
Start with every element of an array unmarked and a score of 0. Repeatedly pick the smallest unmarked value (the leftmost one on a tie), add it to the score, and mark it together with its left and right neighbours. When everything is marked, return the score. Use a heap or sorted indices so it runs in O(n log n).
No answer yet. Write the first one; the best answer gets endorsed.
