You have an array w1, w2, . . . , wn of length n.
You need to choose a subsequence of k elements. Let their indices be 1 ≤ i1 < i2 < . . . < ik ≤ n.
Your goal is to find the minimum possible value of
max ((wi1 + wi2),(wi2 + wi3), . . . ,(wik−1 + wik),(wik + wi1))
among all such subsequences.