Vasu DevC++, STL, Codeforces · 2y

There is a similar way of handling the circular case,

We need two arrays for this,

The Input array A and a new array B,

such that

B[i] = A[i-1], i.e such that B array is left shifted version of A, and last element of A is first of B

Now, use the DP on both the cases and the minimum result of the above two Arrays is the answer

Read more… (70 words)