Add unit tests before developing solution.
Initial solution: using dynamic programming.
Small change in approach due to cyclic nature of the array. 
Use two loops for the cases with and without first element.