How can I find the length of Longest Increasing Sub-sequence if the numbers are arranged in circular fashion. For example:
LIS of 3, 2, 1 is 3 [1, 2, 3].
P.S I know how to solve Linear LIS in O(nlogn).
Problem Source: https://www.codechef.com/problems/D2/
Update: The LIS has to be calculated by going through the circle only once.
Example 2: LIS of 1, 4, 3
is 2 and that could be either of 1, 3
or 1, 4
or 3, 4
.
Thanks